public ServiceResult UpdateCurrency(Currency form) { if (form == null) { return(ServiceResponse.Error("Invalid Currency sent to server.")); } CurrencyManager financeManager = new CurrencyManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter); var dbS = (Currency)financeManager.GetBy(form.UUID); if (dbS == null) { return(ServiceResponse.Error("Currency was not found.")); } if (dbS.DateCreated == DateTime.MinValue) { dbS.DateCreated = DateTime.UtcNow; } dbS.Name = form.Name; dbS.AssetClass = form.AssetClass; // dbS.Country = form.Country; dbS.Symbol = form.Symbol; dbS.Test = form.Test; dbS.Image = form.Image; dbS.Deleted = form.Deleted; dbS.Status = form.Status; dbS.SortOrder = form.SortOrder; return(financeManager.Update(dbS)); }
public ServiceResult DeleteCurrencyBy(string currencyUUID) { if (string.IsNullOrWhiteSpace(currencyUUID)) { return(ServiceResponse.Error("Invalid id.")); } CurrencyManager fm = new CurrencyManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter); Currency c = (Currency)fm.GetBy(currencyUUID); if (c == null) { return(ServiceResponse.Error("Invalid uuid")); } return(fm.Delete(c)); }