public HttpResponseMessage CRAddPaper([FromUri] DistributorSaleProductDTO look)
        {
            try
            {
                objDistributorSale.InsertDistributorSaleProduct(look);
                var message = Request.CreateResponse <DistributorSaleProductDTO>(HttpStatusCode.Created, look);
                message.Headers.Location = new Uri(Request.RequestUri + look.DistributorSaleProductId.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;
            }
        }
示例#2
0
        public ActionResult AddProductT(DistributorSaleProductDTO obj, FormCollection frm, string cityID, string DistributorID)
        {
            try
            {
                if (string.IsNullOrEmpty(Convert.ToString(obj.PaperId)))
                {
                    ModelState.AddModelError("Error", "Please Select Paper Name");
                }
                else
                {
                    obj.DistributorSaleProductId = 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;


                    objdistributorsale.InsertDistributorSaleProduct(obj);

                    TempData["MessageRegistration"] = "Data Saved Successfully!";
                    TempData["AddPaperTrn"]         = "AddPapaerTrn";
                    TempData["UpdtDistTrn"]         = "UpdtDistTrn";
                    // DistributorSaleDTO DS = new DistributorSaleDTO();
                    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", objdistributorsale));
            }
            catch (Exception)
            {
                throw;
            }
        }