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 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); } }