public async Task <IActionResult> RemoveBlock([Bind("Form,Block")] FrmBlocksForms entity) { try { if (ModelState.IsValid) { if (await _context.GetRepository <FrmBlocksForms>().DeleteAsync(entity)) { LogInformation(LogginEvent.Delete, "User deleted the entity: " + entity.ToString()); } else { LogWarnning(LogginEvent.Delete, "Entity wasn't deleted " + entity.ToString()); } return(RedirectToAction("SetBlocks", new { id = entity.Form })); } LogWarnning(LogginEvent.UserError, "Entity is not valid " + entity.ToString()); return(RedirectToAction("SetBlocks", new { id = entity.Form })); } catch (Exception ex) { LogCritical(LogginEvent.Exception, "System failed", ex); return(View("Error")); } }
public async Task <IActionResult> AddBlock([Bind("Form,Block,Order")] FrmBlocksForms entity) { try { if (ModelState.IsValid) { entity = await _context.GetRepository <FrmBlocksForms>().InsertAsync(entity); LogInformation(LogginEvent.Create, "Registered a new entity: " + entity.ToString()); return(RedirectToAction("SetBlocks", new { id = entity.Form })); } LogWarnning(LogginEvent.UserError, "Entity is not valid " + entity.ToString()); return(RedirectToAction("SetBlocks", new { id = entity.Form })); } catch (Exception ex) { LogCritical(LogginEvent.Exception, "System failed", ex); return(View("Error")); } }