Example #1
0
		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);
			}
		}
Example #2
0
		public IActionResult CreateOrEdit(Person dto)
		{
			if (ModelState.IsValid && _db.CreateOrEdit(dto, this.ActionContext))
				return Content("SUCCESS");

			return PartialView(dto);
		}