Example #1
0
        public IActionResult EditEmployeedetail(EmployeeModel employeeModel)
        {
            if (employeeModel.EmployeeDetail.Id == null)
            {
                employeeModel.EmployeeDetail.EmployeeID = employeeModel.Employee.Id;
                employeeDetailService.newEmployeeDetail(employeeModel.EmployeeDetail);
            }
            else
            {
                employeeDetailService.updateEmployeeDetail(employeeModel.EmployeeDetail);
            }


            return(RedirectToAction("List"));
            //if (ModelState.IsValid)
            //{

            //}
            //else
            //{
            //    var errors = ModelState.Select(x => x.Value.Errors)
            //                 .Where(y => y.Count > 0)
            //                 .ToList();
            //    return View();
            //}
        }
Example #2
0
 public HttpResponseMessage Put(EmployeeDetailDTO accessTypeDTO)
 {
     try
     {
         EmployeeDetailDTO dto = service.updateEmployeeDetail(accessTypeDTO);
         if (dto != null)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, dto));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.update_title));
         }
     }
     catch (Exception)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.SeeOther, sysLanguage.CompanyTitlesControllerStrings.update_title));
     }
 }