Example #1
0
        public ActionResult Edit(EmployeeVM viewModel)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    Entities.Employee entity = new Entities.Employee();
                    entity.EmployeeId   = viewModel.EmployeeId;
                    entity.EmployeeCode = viewModel.EmployeeCode.Trim();
                    entity.Password     = viewModel.Password.Trim();
                    entity.FirstName    = viewModel.FirstName.Trim();
                    entity.MiddleName   = viewModel.MiddleName.Trim();
                    entity.LastName     = viewModel.LastName.Trim();
                    entity.Category     = viewModel.Category.Trim();
                    entity.Address      = viewModel.Address.Trim();
                    entity.ContactNo    = viewModel.ContactNo.Trim();
                    entity.DOB          = viewModel.DOB;
                    entity.JoiningDate  = viewModel.JoiningDate;

                    EmployeeBAL balObject = new EmployeeBAL();
                    balObject.Edit(entity);

                    TempData["Message"] = "Employee added successfully !!!";
                }
                else
                {
                    TempData["Error"] = "Some problem while adding Employee !!!";
                }
            }
            catch
            {
                TempData["Error"] = "Some problem while adding Employee !!!";
            }

            return(View(viewModel));
        }