示例#1
0
        public ActionResult Edit(Incident incident)
        {
            ModelState.Remove("CreatedOn");
            ModelState.Remove("ModifiedOn");
            ModelState.Remove("ModifiedUsername");

            if (ModelState.IsValid)
            {
                //Note db_note = noteManager.Find(x => x.Id == note.Id);
                Incident inc = incidentManager.Find(x => x.Id == incident.Id);
                inc.CategoryId  = incident.CategoryId;
                inc.CustomerId  = incident.CustomerId;
                inc.Description = incident.Description;
                inc.EndDate     = incident.EndDate;
                inc.OwnerId     = incident.OwnerId;
                inc.ProductId   = incident.ProductId;
                inc.StartDate   = incident.StartDate;
                inc.StateCode   = incident.StateCode;
                inc.Title       = incident.Title;
                incidentManager.Update(inc);

                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));
        }