public async Task <ActionResult> PostBills(ApiBills bills) { try { var resource = new CoreBills { BillId = bills.BillId, BillLate = bills.BillLate, BillName = bills.BillName, BillPrice = bills.BillPrice, DueDate = bills.DueDate, User = await _userRepo.GetUserById(bills.UserId) }; await _repo.AddBillAsync(resource); return(Ok("Bill had been added!")); } catch (Exception e) { return(BadRequest($"Something went wrong. {e.Message}")); } }