public void addSuggestion(request r, person p) { request req = rs.GetById(r.id); req.suggessedResource_id = p.id; person pp = ps.GetById(p.id); pp.availability = "availableSoon"; rs.Update(req); ps.Update(pp); rs.Commit(); ps.Commit(); }
public async Task <IActionResult> CreateRequest(ServiceRequestEditModel model) { if (ModelState.IsValid) { string output = ""; foreach (DaysOfWeek p in model.Days) { if (p.IsChecked == true) { output += p.name + ","; } } string name = User.Identity.Name; var lp = await userManager.FindByNameAsync(name); string Id = await userManager.GetUserIdAsync(lp); var kp = new ServiceRequest() { Customer = lp, Service = ServiceImp.Get(model.ServiceID), ServiceType = ServiceTypeImp.Get(model.ServiceTypeID), SheduleDate = DateTime.Parse(model.GetDate), DaysOfWork = output, Phone = model.Phone, Address = model.Address, City = model.City, Status = "Not Approved", RequestName = GetName(name) + "/" + model.SheduleDate.ToString() }; ServiceRequestImp.Add(kp); ServiceRequestImp.Commit(); ModelState.Clear(); HttpContext.Session.SetString("RequestSuccess", "Cleaning Request Successful"); return(RedirectToAction("CreateRequest")); } ServiceRequestEditModel po = new ServiceRequestEditModel() { Days = GetDays(), Service = new SelectList(ServiceImp.GetAll(), "Id", "ServiceName"), ServiceType = new SelectList(ServiceTypeImp.GetAll(), "Id", "ServiceType") }; return(View(po)); }