public HttpResponseMessage CRAddPaperReturn([FromUri] DistributorReturnProductDTO look) { try { objDistributorReturn.InsertDistributorReturnProduct(look); var message = Request.CreateResponse <DistributorReturnProductDTO>(HttpStatusCode.Created, look); message.Headers.Location = new Uri(Request.RequestUri + look.DistributorReturnProductId.ToString()); return(message); //string uri = Url.Link("DefaultApi", new { orderID = order.OrderId }); //response.Headers.Location = new Uri(uri); //return response; //return Request.CreateResponse(HttpStatusCode.Created); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); // return 0; } }
public ActionResult AddProductT(DistributorReturnProductDTO obj, FormCollection frm, string cityId, string DistributorId) { try { if (string.IsNullOrEmpty(Convert.ToString(obj.PaperId))) { ModelState.AddModelError("Error", "Please Select Paper Name"); } else { obj.DistributorReturnProductId = 0; obj.CreatedBy = Convert.ToInt32(Session["UserID"]); DateTime timeUtc = System.DateTime.UtcNow; TimeZoneInfo cstZone = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"); DateTime cstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, cstZone); obj.CreatedDate = cstTime; objdistributorReturn.InsertDistributorReturnProduct(obj); TempData["MessageRegistration"] = "Data Saved Successfully!"; TempData["AddPaperTrn"] = "AddPapaerTrn"; TempData["UpdtDistTrn"] = "UpdtDistTrn"; // DistributorReturnDTO DS = new DistributorReturnDTO(); return(RedirectToAction("AddProductT", obj)); } // obj.ListRetailer = BindListRetailer(tri); obj.ListPaperbyDistId = BindListPaperL(cityId, DistributorId); //obj.ListCity = BindListCity(); // ViewData["SelectedrRetailer"] = obj.RetailerId; ViewData["SelectedPaper"] = obj.PaperId; //ViewData["SelectedCity"] = obj.CityId; return(PartialView("Create", objdistributorReturn)); } catch (Exception) { throw; } }