コード例 #1
0
 public async Task <ActionResult> UpdateProductCombine(OutModels.Models.ProductCombine product)
 {
     try
     {
         ProductCombineModel b = (ProductCombineModel)_mapper.Map <OutModels.Models.ProductCombine, ProductCombineModel>(product);
         return(new JsonResult(await this._combinerepository.Update(b)));
     }
     catch (Exception ex)
     {
         return(new JsonResult(ResponseModel.ServerInternalError(data: ex)));
     }
 }
コード例 #2
0
 public async Task <ActionResult> DeleteProductCombine(OutModels.Models.ProductCombine product)
 {
     try
     {
         int id = product.X_Id;
         if (id == 0)
         {
             return(new JsonResult(ResponseModel.Error("موردی یافت نشد")));
         }
         return(new JsonResult(await this._combinerepository.LogicalDelete(id)));
     }
     catch (Exception ex)
     {
         return(new JsonResult(ResponseModel.ServerInternalError(data: ex)));
     }
 }
コード例 #3
0
        public async Task <ActionResult> LoadProductCombine(OutModels.Models.ProductCombine product)
        {
            try
            {
                var AllCombines = ((List <ProductCombineModel>)(await _combinerepository.GetAll()).Data).Where(x => !x.X_IsDeleted && x.X_ProductId == product.X_ProductId).OrderByDescending(x => x.Created_At).ToList();
                foreach (var item in AllCombines)
                {
                    item.WarrantyModel = await _warrantyrepo.GetById(item.X_WarrantyId);

                    item.ColorDetail = await _colorrepo.GetById(item.X_ColorId);
                }
                return(new JsonResult(ResponseModel.Success(data: AllCombines)));
            }
            catch (Exception ex)
            {
                return(new JsonResult(ResponseModel.ServerInternalError(data: ex)));
            }
        }