public UIOffer_CRU(Offer model) { this.id = model.id; this.customerid = model.customerid; this.category = model.category; this.headline = model.headline; this.message = model.message; this.author = model.author; this.sent = DateUtils.ConvertToDateTimeString(model.sent); this.showfromdate = DateUtils.ConvertToDateString(model.showfrom); this.showfromtime = DateUtils.ConvertToTimeString(model.showfrom); this.showuntildate = DateUtils.ConvertToDateString(model.showuntil); this.showuntiltime = DateUtils.ConvertToTimeString(model.showuntil); }
/* Render */ public ActionResult Index() { Account account = base.GetLoginAccount(false); if (account == null || !ProfileOperations.CanRender(account)) { return(base.ToLoginPage()); } using (DataContext context = new DataContext()) { // Info in database may be newer than in session account = context.Accounts.Find(account.id); Customer customer = account.customerid == Customer.CUSTOMER_ANY ? null : context.Customers.Find(account.customerid); ViewBag.UserName = account.email; ViewBag.CustomerName = (customer == null) ? "--" : customer.name; ViewBag.Authorization = Account.AuthzAsString(account.authz); ViewBag.LastLoginTime = DateUtils.ConvertToDateTimeString(account.lastlogin); return(View()); } }