public IActionResult Add(ProductSpecialAreaModels productSpecialAreaModels) { ProductSpacialAreaTable productSpacialAreaTable = new ProductSpacialAreaTable { ProductID = productSpecialAreaModels.ProductID, SpacialAreaID = productSpecialAreaModels.SpecialAreaID, }; ProductSpecialAreaResponse response = _specialAreaService.Add(productSpacialAreaTable); return(response.Code != (int)Constants.ResponseCode.SUCCESS ? StatusCode(500, response) : StatusCode(201, response)); }
public ProductSpecialAreaResponse Add(ProductSpacialAreaTable productSpacialAreaTable) { ProductSpecialAreaResponse response = new ProductSpecialAreaResponse(); try { _repositoryProductSpecialArea.Add(productSpacialAreaTable); _unitOfWork.SaveChanges(); response.SetStatus(Common.Constants.ResponseCode.SUCCESS); return(response); } catch (Exception ex) { response.SetStatus(Common.Constants.ResponseCode.FAILED_ON_DB_PROCESS, ex.Message); return(response); } }
public BaseResponse DeleteProductSpecialArea(int ProductID, int SpecialAreaID) { BaseResponse response = new BaseResponse(); try { ProductSpacialAreaTable productSpacialAreaTable = _repositoryProductSpecialArea.Get(t => t.ProductID == ProductID && t.SpacialAreaID == SpecialAreaID).FirstOrDefault(); _repositoryProductSpecialArea.Delete(productSpacialAreaTable); _unitOfWork.SaveChanges(); response.SetStatus(Common.Constants.ResponseCode.SUCCESS); return(response); } catch (Exception ex) { response.SetStatus(Common.Constants.ResponseCode.FAILED_ON_DB_PROCESS, ex.Message); return(response); } }