public bool CreateOrEdit(Person dto, ActionContext ac = null) { try { if (dto.PersonId == 0) _db.Person.Add(dto); else _db.Update(dto); return _db.SaveChanges() > 0; } catch (Exception ex) { return Utilities.LogException(_controllerContext, ex); } }
public IActionResult CreateOrEdit(Person dto) { if (ModelState.IsValid && _db.CreateOrEdit(dto, this.ActionContext)) return Content("SUCCESS"); return PartialView(dto); }