public async Task UpdateOther(UserOther other) { if (db != null && other.Fk_Info_Id != null) { db.UserOther.Update(other); await db.SaveChangesAsync(); } }
public async Task <int> AddOther(UserOther other) { int result = 0; if (db != null && other.Fk_Info_Id != null) { await db.AddAsync(other); await db.SaveChangesAsync(); return(result = other.Id); } return(result); }
public async Task <IActionResult> UpdateOther([FromBody] UserOther model) { if (ModelState.IsValid) { try { await resumeRepository.UpdateOther(model); return(Ok()); } catch (Exception ex) { if (ex.GetType().FullName == "Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException") { return(NotFound()); } return(BadRequest()); } } return(BadRequest()); }
public async Task <IActionResult> AddOther([FromBody] UserOther model) { if (ModelState.IsValid) { try { var id = await resumeRepository.AddOther(model); if (id >= 0) { return(Ok(id)); } else { return(NotFound()); } } catch (Exception) { return(BadRequest()); } } return(BadRequest()); }