public ActionResult Complaints(Complaint complaint) { complaint.CustomerID = (int)Session["id"]; complaint.CreatedDate = DateTime.Now; _complaintService.Add(complaint); return(RedirectToAction("Index")); }
public IHttpActionResult Post([FromBody] NewComplaint complaint) { List <string> documents = new List <string>(); complaintService = new ComplaintService(); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var response = complaintService.Add(complaint); if (response.Success) { //Create a new directory for the complaint created just now string directoryName = "Complaints-" + response.ReturnedId; var mappedPath = HttpContext.Current.Server.MapPath("~/Uploads/"); System.IO.Directory.CreateDirectory(mappedPath + directoryName); return(Ok(response.ReturnedId)); } return(Content(HttpStatusCode.BadRequest, response.Message)); }