public async Task <ManagerResult <bool> > RemoveEquity(Guid modelEquityId) { ManagerResult <bool> mgrResult = new ManagerResult <bool>(); try { ModelEquity modelEquity = new ModelEquity() { Id = modelEquityId }; using NpgsqlConnection db = new NpgsqlConnection(connString); { mgrResult.Entity = await db.DeleteAsync(modelEquity); } } catch (Exception ex) { mgrResult.Exception = ex; mgrResult.Success = false; mgrResult.Message = ex.Message; } return(mgrResult); }
public async Task <ManagerResult <ModelEquity> > Save(ModelEquity modelEquity) { ManagerResult <ModelEquity> mgrResult = new ManagerResult <ModelEquity>(); try { using (NpgsqlConnection db = new NpgsqlConnection(connString)) { if (modelEquity.Id != default) { await db.UpdateAsync(modelEquity); } else { await db.InsertAsync(modelEquity); } } mgrResult.Entity = modelEquity; } catch (Exception ex) { mgrResult.Exception = ex; } return(mgrResult); }