Example #1
0
        public ActionResult Create(Incident incident)
        {
            incident.StartDate = DateTime.Now;
            incident.EndDate   = DateTime.Now.AddDays(7);
            ModelState.Remove("CreatedOn");
            ModelState.Remove("ModifiedOn");
            ModelState.Remove("ModifiedUsername");

            if (ModelState.IsValid)
            {
                incidentManager.Insert(incident);
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryId = new SelectList(categoryManager.List(), "Id", "Name");
            ViewBag.CustomerId = new SelectList(customerManager.List(), "Id", "Fullname", "Surname");
            ViewBag.OwnerId    = new SelectList(cmUserManager.List(), "Id", "Fullname", "Surname");
            ViewBag.ProductId  = new SelectList(productManager.List(), "Id", "Name");
            return(View(incident));
        }