public ViewResult Create(int CustomerId) { var model = new MemberCardViewModel(); model.CustomerId = CustomerId; model.ListMemberCardType = MemberCardTypeService.Get() .Select(item => new MemberCardTypeViewModel { Id = item.Id, Name = item.Name, Image = item.Image }) .OrderBy(item => item.Name) .ToList(); ViewBag.SuccessMessage = TempData["SuccessMessage"]; ViewBag.FailedMessage = TempData["FailedMessage"]; ViewBag.AlertMessage = TempData["AlertMessage"]; return(View(model)); }
public ViewResult Index(string txtSearch) { IEnumerable <MemberCardTypeViewModel> q = MemberCardTypeService.Get() .Select(item => new MemberCardTypeViewModel { Id = item.Id, CreatedUserId = item.CreatedUserId, CreatedDate = item.CreatedDate, ModifiedUserId = item.ModifiedUserId, ModifiedDate = item.ModifiedDate, Name = item.Name, TargetPoint = item.TargetPoint }).OrderBy(m => m.Name); ViewBag.SuccessMessage = TempData["SuccessMessage"]; ViewBag.FailedMessage = TempData["FailedMessage"]; ViewBag.AlertMessage = TempData["AlertMessage"]; return(View(q)); }