public ProductSpecialAreaResponse GetProductSpecialAreas() { ProductSpecialAreaResponse response = new ProductSpecialAreaResponse(); try { foreach (var item in _repositoryProductSpecialArea.Get().ToList()) { response.ProductSpecialAreaModels.Add(new ProductSpecialAreaModels { ProductID = item.ProductID, SpecialAreaID = item.SpacialAreaID, ProductName = item.Product.ProductName, SpecialAreaName = item.SpacialArea.Name }); } 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 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 IActionResult GetProductSpecialAreas() { ProductSpecialAreaResponse response = _specialAreaService.GetProductSpecialAreas(); return(response.Code != (int)Constants.ResponseCode.SUCCESS ? StatusCode(500, response) : StatusCode(200, response)); }