public ResponseMessage Delete(int id) { ResponseMessage response = new ResponseMessage(); if (_productService.IsModelAlreadyUsed(id) == true) { response.IsError = true; response.ErrorCodes.Add(string.Format(GeneralLocalisations.CannotBeDeleted, ModelLocalisations.Model)); return response; } _modelRepository.Delete(id); return response; }
public ResponseMessage Update(Model entity) { ResponseMessage response = new ResponseMessage(); if (_productService.IsModelAlreadyUsed(entity.Id) == true) { response.IsError = true; response.ErrorCodes.Add(string.Format(GeneralLocalisations.CannotBeEdited, ModelLocalisations.Model)); return response; } _modelRepository.Update(entity); return response; }
public ResponseMessage Update(Type entity) { ResponseMessage response = new ResponseMessage(); if (_productService.IsTypeAlreadyUsed(entity.Id) == true) { response.IsError = true; response.ErrorCodes.Add(string.Format(GeneralLocalisations.CannotBeEdited, OriginLocalisations.Origin)); return response; } _typeRepository.Update(entity); return response; }
public ResponseMessage Add(Product entity) { ResponseMessage response = new ResponseMessage(); if (_productRepository.GetByNumber(entity.Number) != null) { response.IsError = true; response.ErrorCodes.Add(string.Format(GeneralLocalisations.AlreadyExist, ProductLocalisations.Product,ProductLocalisations.Number, entity.Number)); return response; } entity.DateEntered = DateTime.Now; entity.Promoted = false; _productRepository.Add(entity); return response; }
public ResponseMessage Update(Picture entity) { ResponseMessage response = new ResponseMessage(); _pictureRepository.Update(entity); return response; }
public ResponseMessage Delete(int id) { ResponseMessage response = new ResponseMessage(); _productRepository.Delete(id); return response; }
public ResponseMessage Update(Product entity) { ResponseMessage response = new ResponseMessage(); var product = _productRepository.GetByNumber(entity.Number); if ( product != null) { if (product.Id != entity.Id) { response.IsError = true; response.ErrorCodes.Add(string.Format(GeneralLocalisations.AlreadyExist, ProductLocalisations.Product, ProductLocalisations.Number, entity.Number)); return response; } } _productRepository.Update(entity); return response; }