Controller with enum
Creating a controller for opening balance to list Account Categories
(Asset and Expenditure)only
Controller
public ViewResult OpeningBalance(Enum cg)
{
return View(new Accounts().List(Category.Asset)); // Now it shows only
Asset accounts but I need expenditure also)//
}
Accounts class
namespace xyz.Models.Accounts
public class Accounts : IEnumerable<Account> {
Category? _type;
public Accounts(Category category) {
_type = category;
}
public List<Account> List(Category category) {
return list(category, 0);
}
List<Account> list(Category? category, int groupId = 0) {
List<Account> retVal = new List<Account>();
using (DatabaseCommaned cmd = new DatabaseCommaned()) {
cmd.CommandText =
string.Format(..................................
......................}
}
Category class
namespace xyz.Models.Accounts {
public enum Category {
Income = 0,
Expenditure = 1,
Asset = 2,
Liability = 3
}
}
No comments:
Post a Comment