public ActionResult DeleteConfirmed(int id) { EmployeeCertification employeecertification = db.EmployeeCertifications.Find(id); db.EmployeeCertifications.Remove(employeecertification); db.SaveChanges(); return(RedirectToAction("ViewEmployeeCertification")); }
public ActionResult EditEmployeeCertification([Bind(Include = "Id,EmployeeId,CertificationId,InstituteName,FromDate,ToDate")] EmployeeCertification employeecertification) { if (ModelState.IsValid) { db.Entry(employeecertification).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ViewEmployeeCertification")); } ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "EmployeeRegNo", employeecertification.EmployeeId); ViewBag.CertificationId = new SelectList(db.Certifications, "Id", "CertificationName", employeecertification.CertificationId); return(View(employeecertification)); }
public async Task <string> UpdateEmployeeCertification(int id, EmployeeCertification employeeCertification) { try { var res = await _repository.UpdateEmployeeCertification(id, employeeCertification); return(res); } catch (Exception ex) { throw ex; } }
public async Task <EmployeeCertification> CreateNewEmployeeCertification(EmployeeCertification employeeCertification) { try { var res = await _repository.CreateNewEmployeeCertification(employeeCertification); return(res); } catch (Exception ex) { throw ex; } }
public async Task <EmployeeCertification> CreateNewEmployeeCertification(EmployeeCertification employeeCertification) { try { _context.EmployeeCertifications.Add(employeeCertification); await _context.SaveChangesAsync(); return(employeeCertification); } catch (Exception ex) { throw ex; } }
// GET: /EmployeeCertification/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EmployeeCertification employeecertification = db.EmployeeCertifications.Find(id); if (employeecertification == null) { return(HttpNotFound()); } return(View(employeecertification)); }
// GET: /EmployeeCertification/Edit/5 public ActionResult EditEmployeeCertification(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EmployeeCertification employeecertification = db.EmployeeCertifications.Find(id); if (employeecertification == null) { return(HttpNotFound()); } ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "EmployeeRegNo", employeecertification.EmployeeId); ViewBag.CertificationId = new SelectList(db.Certifications, "Id", "CertificationName", employeecertification.CertificationId); return(View(employeecertification)); }
public async Task <IActionResult> CreateEmployeeCertification(EmployeeCertification employeeCertification) { try { var response = await _service.CreateNewEmployeeCertification(employeeCertification); if (response != null) { return(Ok(response)); } return(StatusCode(StatusCodes.Status204NoContent)); } catch (Exception ex) { throw ex; } }
public async Task <string> UpdateEmployeeCertification(int id, EmployeeCertification employeeCertification) { try { var res = await _context.EmployeeCertifications.FirstOrDefaultAsync(m => m.EmployeeCertificationId == id); res.EmployeeName = employeeCertification.EmployeeName; res.Certification = employeeCertification.Certification; res.Institute = employeeCertification.Institute; res.GrantedOn = employeeCertification.GrantedOn; res.ValidThru = employeeCertification.ValidThru; _context.Update(res); await _context.SaveChangesAsync(); return("Updated Record"); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> UpdateEmployeeCertification(int EmployeeCertificationId, EmployeeCertification employeeCertification) { try { var res = await _service.UpdateEmployeeCertification(EmployeeCertificationId, employeeCertification); if (res != null) { return(Ok(res)); } return(StatusCode(StatusCodes.Status204NoContent)); } catch (Exception ex) { throw; } }