public ServiceResult DeletePriceRuleBy(string uuid) { if (string.IsNullOrWhiteSpace(uuid)) { return(ServiceResponse.Error("Invalid id.")); } PriceManager fm = new PriceManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter); PriceRule c = (PriceRule )fm.GetBy(uuid); if (c == null) { return(ServiceResponse.Error("Invalid uuid")); } return(fm.Delete(c)); }
public ServiceResult Update(PriceRule fat) { if (fat == null) { return(ServiceResponse.Error("Invalid PriceRule sent to server.")); } PriceManager financeManager = new PriceManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter); var dbS = (PriceRule)financeManager.GetBy(fat.UUID); if (dbS == null) { return(ServiceResponse.Error("PriceRule was not found.")); } if (dbS.DateCreated == DateTime.MinValue) { dbS.DateCreated = DateTime.UtcNow; } dbS.Name = fat.Name; dbS.Image = fat.Image; dbS.Deleted = fat.Deleted; dbS.Status = fat.Status; dbS.SortOrder = fat.SortOrder; dbS.Expires = fat.Expires; dbS.ReferenceType = fat.ReferenceType; dbS.Code = fat.Code; dbS.Operand = fat.Operand; dbS.Operator = fat.Operator; dbS.Minimum = fat.Minimum; dbS.Maximum = fat.Maximum; dbS.Mandatory = fat.Mandatory; dbS.MaxUseCount = fat.MaxUseCount; return(financeManager.Update(dbS)); }