public ActionResult EditRequest(Request request) { var search_id = request.ID; using (RequestContext context = new RequestContext()) { Request search_request = context.Requests.Where(x => x.ID == search_id).FirstOrDefault(); search_request.Category = request.Category; search_request.ShortDescription = request.ShortDescription; search_request.DetailsDescription = request.DetailsDescription; search_request.IsWarranty = request.IsWarranty; search_request.ManufacturingFirm = request.ManufacturingFirm; search_request.ContactData = request.ContactData; context.SaveChanges(); } if (User.IsInRole("admin")) { return GetAllRequests(null); } return GetRequestsById(null); }
public ActionResult Index(Request responseModel) { double processDays = 1; using (RequestContext context = new RequestContext()) { Request new_request = new Request { Category = responseModel.Category, ShortDescription = responseModel.ShortDescription, DetailsDescription = responseModel.DetailsDescription, IsWarranty = responseModel.IsWarranty, ManufacturingFirm = responseModel.ManufacturingFirm, ContactData = responseModel.ContactData, InitialDate = DateTime.Now, DeadlineRequest = DateTime.Now.AddDays(processDays), State = "Новая", MasterID = 1, ClientID = User.Identity.GetUserId() }; context.Requests.Add(new_request); context.SaveChanges(); } if (User.IsInRole("admin")) { return GetAllRequests(null); } return GetRequestsById(null); }