public async Task <IActionResult> Create(BorrowerModel borrower) { if (ModelState.IsValid) { try { _context.Add(borrower); await _context.SaveChangesAsync(); } catch (Exception) { return(BadRequest(new { error = "There was an error creating this borrower" })); } } return(Ok(borrower)); }
public async Task <IActionResult> Create(TrusteeModel trustee) { if (ModelState.IsValid) { try { _context.Add(trustee); await _context.SaveChangesAsync(); } catch (Exception) { return(BadRequest(new { error = "There was an error creating this trustee" })); } } return(Ok(trustee)); }
public async Task <IActionResult> Create(NoteModel property) { if (ModelState.IsValid) { try { _context.Add(property); await _context.SaveChangesAsync(); } catch (Exception) { return(BadRequest(new { error = "There was an error creating this property" })); } } return(Ok(property)); }
public async Task <IActionResult> Create(BrokerServicingModel brokerservicing) { if (ModelState.IsValid) { try { _context.Add(brokerservicing); await _context.SaveChangesAsync(); } catch (Exception) { return(BadRequest(new { error = "There was an error creating this brokerservicing" })); } } return(Ok(brokerservicing)); }
public async Task <IActionResult> Create(FinanceChargeModel finCharge) { if (ModelState.IsValid) { try { _context.Add(finCharge); await _context.SaveChangesAsync(); } catch (Exception) { return(BadRequest(new { error = "There was an error creating this financecharge" })); } } return(Ok(finCharge)); }
public async Task <IActionResult> Create(EscrowModel escrow) { if (ModelState.IsValid) { try { _context.Add(escrow); await _context.SaveChangesAsync(); } catch (Exception) { return(BadRequest(new { error = "There was an error creating this deduction" })); } } return(Ok(escrow)); }
public async Task <IActionResult> Create([Bind("Username,FName,LName,IsAdmin,Password")] UserModel user) { // Validate password format and length if (user.Password.Length < minimumPasswordLength) { return(BadRequest(new { error = "Password must be at least 6 characters long" })); } if (ModelState.IsValid) { try { _context.Add(user); await _context.SaveChangesAsync(); } catch (Exception) { return(BadRequest(new { error = "There was an error creating your account. Please contact support." })); } return(RedirectToAction(nameof(Index))); } return(Ok(user)); }