Beispiel #1
0
 public ActionResult AddEmploye(AddModel model)
 {
     try
     {
         var department = _departmentsService.GetById(model.Department);
         var language   = _languagesService.GetById(model.Language);
         var data       = new EmployesDomain()
         {
             LastName   = model.LastName,
             FirstName  = model.FirstName,
             Age        = Int32.Parse(model.Age),
             IsDeleted  = false,
             Department = department,
             Gender     = (EGender)model.Gender,
             Experience = new ExperienceDomain()
             {
                 LanguageId = model.Language
             }
         };
         _employesService.AddEmploye(data);
         return(Json(new { redirectUrl = Url.Action("Index", "Home") }));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Beispiel #2
0
        public ActionResult Edit(int?id)
        {
            if (!id.HasValue)
            {
                SetViewBagsAndHeaders(Request.IsAjaxRequest(), "Edit language", "Error. Go back to list and choose language.");
                return(View(new LanguagesViewModels()));
            }
            var idLang = id ?? 0;
            var model  = Mapper.Map <LanguagesViewModels>(languagesService.GetById(idLang).FirstOrDefault());

            SetViewBagsAndHeaders(Request.IsAjaxRequest(), "Edit language", " ");
            if (Request.IsAjaxRequest())
            {
                return(PartialView(model));
            }

            return(View(model));
        }