public JsonResult DeleteProduct([FromBody] DeleteProductRequest request) { BaseResponse baseResponse = new BaseResponse(); Bayi.DataAccess.Product byId = this._productService.GetById(request.Id); byId.IsActive = false; this._productService.Update(byId); baseResponse.Number = 1; baseResponse.Message = "Ürün başarıyla silinmiştir.."; return(this.Json((object)baseResponse)); }
public IActionResult Update(int productId) { Bayi.DataAccess.Product byId = this._productService.GetById(productId); return((IActionResult)this.View((object)new ListProductSpecificResponse() { Id = byId.Id, ProductName = byId.Name, BuyingPrice = string.Format("{0:#,0.00}", (object)byId.AdminBuyPrice), SalePrice = string.Format("{0:#,0.00}", (object)byId.AdminSalePrice) })); }
public JsonResult SubtractStockProduct([FromBody] StockProductRequest request) { BaseResponse baseResponse = new BaseResponse(); baseResponse.Number = 1; baseResponse.Message = "Stok başarıyla çıkarılmıştır.."; Bayi.DataAccess.Product byId = this._productService.GetById(request.ProductId); byId.Stock -= Convert.ToInt32(request.Quantity); this._productService.Update(byId); return(this.Json((object)baseResponse)); }
public JsonResult UpdateProduct([FromBody] UpdateProductRequest request) { BaseResponse baseResponse = new BaseResponse(); Bayi.DataAccess.Product byId = this._productService.GetById(request.Id); byId.Name = request.ProductName; byId.AdminBuyPrice = Convert.ToDecimal(request.BuyingPrice.Replace(',', ';').Replace('.', ',').Replace(';', '.')); byId.AdminSalePrice = Convert.ToDecimal(request.SalePrice.Replace(',', ';').Replace('.', ',').Replace(';', '.')); this._productService.Update(byId); baseResponse.Number = 1; baseResponse.Message = "Ürün başarıyla değiştirilmiştir.."; return(this.Json((object)baseResponse)); }