// GET: Commission/Create
        public ActionResult Create()
        {
            //var newItem = new CommissionViewModel();
            var newItem = new CommissionViewModel()
            {
                Percentage = 5,
                DtCreated = DateTime.UtcNow,
                DtUpdated = DateTime.UtcNow
            };

            return View(newItem);
        }
        public CommissionViewModel Update(CommissionViewModel item)
        {
            if (item == null)
                return null;

            var itemToUpdate = db.Commissions.Where(x => x.CommissionId == item.CommissionId).FirstOrDefault();
            itemToUpdate.DtUpdated = DateTime.UtcNow;
            itemToUpdate.Percentage = item.Percentage;
            db.SaveChanges();

            return itemToUpdate;
        }
        public ActionResult Create(CommissionViewModel item)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (item.Percentage < 0)
                    {
                        return RedirectToAction("Home", "Error404");
                    }
                    db.Commissions.Add(item);
                    db.SaveChanges();
                }

                return RedirectToAction("Retrieve");
            }
            catch (Exception ex)
            {
                return new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.ToString());
            }
        }
 public CommissionViewModel Create(CommissionViewModel item)
 {
     return null;
 }
        public ActionResult Update(CommissionViewModel item)
        {
            try
            {
                if (User.IsInRole("Admin"))
                {
                    if (item == null)
                        return RedirectToAction("Home", "Error404");

                    var record = _repo.Update(item);
                    if (record == null)
                        return RedirectToAction("Home", "Error404");

                    return RedirectToAction("Retrieve");
                }

                return RedirectToAction("Login", "Account");
            }
            catch (Exception ex)
            {
                return new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.ToString());
            }
        }