Exemple #1
0
        // GET: /ProductMaster/Edit/5

        public ActionResult Edit(int id)
        {
            TdsGroup pt = _TdsGroupService.GetTdsGroup(id);

            if (pt == null)
            {
                return(HttpNotFound());
            }
            return(View("Create", pt));
        }
Exemple #2
0
        public ActionResult Edit(TdsGroup pt)
        {
            List <LogTypeViewModel> LogList = new List <LogTypeViewModel>();

            if (ModelState.IsValid)
            {
                TdsGroup temp = _TdsGroupService.Find(pt.TdsGroupId);

                TdsGroup ExRec = Mapper.Map <TdsGroup>(temp);

                temp.TdsGroupName = pt.TdsGroupName;
                temp.ModifiedDate = DateTime.Now;
                temp.ModifiedBy   = User.Identity.Name;
                temp.ObjectState  = Model.ObjectState.Modified;
                _TdsGroupService.Update(temp);

                LogList.Add(new LogTypeViewModel
                {
                    ExObj = ExRec,
                    Obj   = temp,
                });
                XElement Modifications = new ModificationsCheckService().CheckChanges(LogList);

                try
                {
                    _unitOfWork.Save();
                }

                catch (Exception ex)
                {
                    string message = _exception.HandleException(ex);
                    ModelState.AddModelError("", message);
                    return(View("Create", pt));
                }

                LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                {
                    DocTypeId       = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.TdsGroup).DocumentTypeId,
                    DocId           = temp.TdsGroupId,
                    ActivityType    = (int)ActivityTypeContants.Modified,
                    xEModifications = Modifications,
                }));

                return(RedirectToAction("Index").Success("Data saved successfully"));
            }
            return(View("Create", pt));
        }
Exemple #3
0
        // GET: /ProductMaster/Delete/5

        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TdsGroup TdsGroup = _TdsGroupService.GetTdsGroup(id);

            if (TdsGroup == null)
            {
                return(HttpNotFound());
            }

            ReasonViewModel vm = new ReasonViewModel()
            {
                id = id,
            };

            return(PartialView("_Reason", vm));
        }
Exemple #4
0
        public ActionResult Create(TdsGroup vm)
        {
            TdsGroup pt = vm;

            if (ModelState.IsValid)
            {
                pt.CreatedDate  = DateTime.Now;
                pt.ModifiedDate = DateTime.Now;
                pt.CreatedBy    = User.Identity.Name;
                pt.ModifiedBy   = User.Identity.Name;
                pt.ObjectState  = Model.ObjectState.Added;
                _TdsGroupService.Create(pt);

                try
                {
                    _unitOfWork.Save();
                }

                catch (Exception ex)
                {
                    string message = _exception.HandleException(ex);
                    ModelState.AddModelError("", message);
                    return(View("Create", vm));
                }

                LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel
                {
                    DocTypeId    = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.TdsGroup).DocumentTypeId,
                    DocId        = pt.TdsGroupId,
                    ActivityType = (int)ActivityTypeContants.Added,
                }));

                return(RedirectToAction("Create").Success("Data saved successfully"));
            }
            return(View("Create", vm));
        }
Exemple #5
0
        // GET: /ProductMaster/Create

        public ActionResult Create()
        {
            TdsGroup vm = new TdsGroup();

            return(View("Create", vm));
        }
 public void Update(TdsGroup pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <TdsGroup>().Update(pt);
 }
 public void Delete(TdsGroup pt)
 {
     _unitOfWork.Repository <TdsGroup>().Delete(pt);
 }
 public TdsGroup Create(TdsGroup pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <TdsGroup>().Insert(pt);
     return(pt);
 }
 public TdsGroup Add(TdsGroup pt)
 {
     _unitOfWork.Repository <TdsGroup>().Insert(pt);
     return(pt);
 }