public async Task <ActionResult> AddProduct(OutModels.Models.Product product) { try { ProductModel b = (ProductModel)_mapper.Map <OutModels.Models.Product, ProductModel>(product); return(new JsonResult(await this._repository.Insert(b))); } catch (Exception ex) { return(null); } }
public async Task <ActionResult> UpdateProduct(OutModels.Models.Product product) { try { ProductModel b = (ProductModel)_mapper.Map <OutModels.Models.Product, ProductModel>(product); return(new JsonResult(await this._repository.Update(b))); } catch (Exception ex) { return(new JsonResult(ResponseModel.ServerInternalError(data: ex))); } }
public async Task <ActionResult> DeleteProduct(OutModels.Models.Product product) { try { int id = product.P_Id; if (id == 0) { return(new JsonResult(ResponseModel.Error("موردی یافت نشد"))); } return(new JsonResult(await this._repository.LogicalDelete(id))); } catch (Exception ex) { return(null); } }