public async Task <IActionResult> Edit(int id, [Bind("CasualTaskId,CasualTask,TimeEstiamteInHours,DateStarted,DateCompleted,IsEnabled")] CasualTasks casualTasks) { if (id != casualTasks.CasualTaskId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(casualTasks); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CasualTasksExists(casualTasks.CasualTaskId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(casualTasks)); }
public async Task <IActionResult> Edit(int id, [Bind("CasualRoleId,CasualRole,HourlyRateInZar,IsEnabled")] CasualRoles casualRoles) { if (id != casualRoles.CasualRoleId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(casualRoles); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CasualRolesExists(casualRoles.CasualRoleId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(casualRoles)); }
public async Task <IActionResult> Edit(int id, [Bind("CasualEmployeeId,CasualRoleId,Name,Surname,Email,ProfilePicture,CurrentHourlyRateInZar,IsEnabled")] CasualEmployees casualEmployees, IFormFile image) { if (id != casualEmployees.CasualEmployeeId) { return(NotFound()); } if (ModelState.IsValid) { try { if (image != null) { if (image.Length > 0) { byte[] p1 = null; using (var fs1 = image.OpenReadStream()) using (var ms1 = new MemoryStream()) { fs1.CopyTo(ms1); p1 = ms1.ToArray(); } casualEmployees.ProfilePicture = p1; } } _context.Update(casualEmployees); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CasualEmployeesExists(casualEmployees.CasualEmployeeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CasualRoleId"] = new SelectList(_context.CasualRoles, "CasualRoleId", "CasualRole", casualEmployees.CasualRoleId); return(View(casualEmployees)); }