public ActionResult Create(RepairVM model) { try { if (ModelState.IsValid) { if (model.InvoiceDate == null) { model.InvoiceDate = DateTime.Now; } if (model.ServiceReportBillFileBase != null) { model.ServiceReportBillFile = model.ServiceReportBillFileBase.FileName; } if (model.VendorInvoicesFileBase != null) { model.VendorInvoicesFile = model.VendorInvoicesFileBase.FileName; } var invoiceId = _repairBL.Add(RepairMapper.Map(model)); if (invoiceId > 0) { var filePath = ConfigurationManager.AppSettings["RepairFilePath"] + invoiceId + "\\"; UploadFile(model.VendorInvoicesFileBase, filePath); UploadFile(model.ServiceReportBillFileBase, filePath); } } else { return(View("Create", model)); } TempData["Success"] = "Entry added successfully"; return(View("../RepairHome/RepairHome")); } catch { TempData["Exception"] = "The server encountered an error while processing the request. Please contact the technical team."; return(View("Create", model)); } }
public HttpResponseMessage Post(RepairDTO partDTO) { var partID = _repairBL.Add(partDTO); return(_httpResponseMessageBuilder.GetSimpleResponse(partID, Request)); }