Exemple #1
0
        public ActionResult Create(EmployeeTaskRatingViewModel model)
        {
            try
            {
                // TODO: Add insert logic here
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }
                var EmployeeTaskRating = _mapper.Map <EmployeeTaskRating>(model);
                var isSuccess          = _repo.Create(EmployeeTaskRating);
                if (!isSuccess)
                {
                    ModelState.AddModelError("", "Something Went Wrong!");
                    return(View(model));
                }

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                ModelState.AddModelError("", "Something Went Wrong!");
                return(View(model));
            }
        }
Exemple #2
0
        public ActionResult Delete(int id, EmployeeTaskRatingViewModel model)
        {
            try
            {
                // TODO: Add delete logic here
                var EmployeeTaskRating = _repo.FindById(id);
                if (EmployeeTaskRating == null)
                {
                    return(NotFound());
                }

                var isSuccess = _repo.Delete(EmployeeTaskRating);
                if (!isSuccess)
                {
                    return(View(model));
                }


                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View(model));
            }
        }