public ActionResult Delete(Charge elem)
        {
            try
            {
                _chargeService.Delete(elem.Id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(ReasonViewModel vm)
        {
            List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

            if (ModelState.IsValid)
            {
                var temp = _ChargeService.Find(vm.id);

                _ChargeService.Delete(vm.id);

                LogList.Add(new LogTypeViewModel
                {
                    ExObj = temp,
                });

                XElement Modifications = new ModificationsCheckService().CheckChanges(LogList);
                try
                {
                    _unitOfWork.Save();
                }

                catch (Exception ex)
                {
                    string message = _exception.HandleException(ex);
                    ModelState.AddModelError("", message);
                    return(PartialView("_Reason", vm));
                }
                //LogActivity.LogActivityDetail(new DocumentTypeService(_unitOfWork).Find(MasterDocTypeConstants.Charge).DocumentTypeId,
                //temp.ChargeId,
                //null,
                //(int)ActivityTypeContants.Deleted,
                //vm.Reason,
                //User.Identity.Name,
                //temp.ChargeName, Modifications);

                LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                {
                    DocTypeId       = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.Charge).DocumentTypeId,
                    DocId           = vm.id,
                    ActivityType    = (int)ActivityTypeContants.Deleted,
                    UserRemark      = vm.Reason,
                    xEModifications = Modifications,
                }));

                return(Json(new { success = true }));
            }
            return(PartialView("_Reason", vm));
        }