public void EditRequest(int requestId,Request requestParam)
 {
     var request = FindRequestById(requestId);
     if (request!=null)
     {
         request = requestParam;
         _applicatioDbContext.SaveChanges();
     }
 }
 public void AddNewRequest(Request request)
 {
     _requests.Add(request);
     _applicatioDbContext.SaveChanges();
 }
Esempio n. 3
0
        public virtual ActionResult NewRequest(NewRequestViewModel request, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {

                request.UploadPath = UploadFile(file);
                request.InterceptionCode = GenerateInterceptionCode();
                var requestObject = new Request
                {
                    Name = request.Name,
                    Description = request.Description,
                    Email = request.Email,
                    InterceptionCode = request.InterceptionCode,
                    PhoneNumber = request.PhoneNumber,
                    RequestId = request.RequestId,
                    Subject = request.Subject,
                    UploadPath = request.UploadPath,
                    DeliveryDays = request.DeliveryDays + request.DaysOrWeeks

                };
                _requestRepository.AddNewRequest(requestObject);
                return View(MVC.Home.Views.success, requestObject);
            }
            else
            {
                ModelState.AddModelError("", "ورودی ها نامعتبر هستند");
            }
            return View(request);
        }