public IHttpActionResult AddBudget(int hId, string name, string desc, string ownerId, float tgt) { try { Guid ownerIdGuid = new Guid(ownerId); } catch (FormatException e) { return(BadRequest($"Invalid Value for ownerId: '{ownerId}'")); } var targetDecResult = Convert.ToDecimal(Math.Round(tgt, 2, MidpointRounding.AwayFromZero)); DateTime created = DateTime.Now; var budget = new Budget { HouseholdId = hId, Name = name, Description = desc, OwnerId = ownerId, TargetAmount = targetDecResult, CurrentAmount = 0 }; return(Ok(_db.AddBudget(budget))); }
public IHttpActionResult AddBudget(int hhId, string ownerId, string name, float targetAmount, float currentAmount) { return(Ok(db.AddBudget(hhId, ownerId, name, targetAmount, currentAmount))); }