public async Task <IActionResult> Edit(int id, [Bind("PermissionLogID,PermissionID,LogDate,ModifiKey,ModifyValue")] PermissionLog permissionLog) { if (id != permissionLog.PermissionLogID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(permissionLog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PermissionLogExists(permissionLog.PermissionLogID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PermissionID"] = new SelectList(_context.Permissions, "PermissionID", "PermissionID", permissionLog.PermissionID); return(View(permissionLog)); }
public Response <PermissionDto> Create(PermissionDto data, string action) { var response = new Response <PermissionDto> { Action = action }; var permisionLog = new PermissionLog { Action = action, Date = DateTime.Now, EmployeeLastName = data.EmployeeLastName, EmployeeName = data.EmployeeName, PermissionTypeId = data.PermissionType.Id }; try { _permissionLogs.Add(permisionLog); SavePermisionLog(); response.Succeed = true; response.Body.Add(data); return(response); } catch (Exception e) { response.Error = new Error { Name = e.Source, Detail = e.Message }; return(response); } }
public async Task <IActionResult> Create([Bind("PermissionLogID,PermissionID,LogDate,ModifiKey,ModifyValue")] PermissionLog permissionLog) { if (ModelState.IsValid) { _context.Add(permissionLog); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PermissionID"] = new SelectList(_context.Permissions, "PermissionID", "PermissionID", permissionLog.PermissionID); return(View(permissionLog)); }
private PermissionLog CreateLog(string message,short operation,int UserId) { SessionStorage sessionStorage = new SessionStorage(HttpContext.Current.User.Identity.Name); PermissionLog log=new PermissionLog(); log.CreatedBy = sessionStorage.UserId; log.CreatedDate = DateTime.Now; log.Message = message; log.Operation = operation; log.UserId = UserId; return log; }
public void AddPermissionLog(PermissionLog log) { DataService.Execute("AddPermissionLog", log); }