Ejemplo n.º 1
0
 public bool DeleteActionTakenType(ActionTakenType type)
 {
     if (type != null && type.ActionsTaken.Count == 0)
     {
         this.actionTakenTypeRepo.Delete(type);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            ActionTakenType type = this.actionTakenTasks.GetActionTakenType(id);

            if (type != null)
            {
                return(View(new ActionTakenTypeViewModel(type)));
            }
            return(new HttpNotFoundResult());
        }
Ejemplo n.º 3
0
        public ActionResult Details(int id)
        {
            ActionTakenType att = this.actionTakenTasks.GetActionTakenType(id);

            if (att != null)
            {
                return(View(att));
            }
            return(new HttpNotFoundResult());
        }
Ejemplo n.º 4
0
 public ActionTakenTypeViewModel(ActionTakenType type)
 {
     if (type != null)
     {
         this.Id = type.Id;
         this.ActionTakenTypeName = type.ActionTakenTypeName;
         this.Notes          = type.Notes;
         this.IsRemedial     = type.IsRemedial;
         this.IsDisciplinary = type.IsDisciplinary;
     }
 }
Ejemplo n.º 5
0
 public ActionResult Create(ActionTakenTypeViewModel vm)
 {
     if (ModelState.IsValid)
     {
         ActionTakenType type = new ActionTakenType();
         type.ActionTakenTypeName = vm.ActionTakenTypeName;
         type.Notes          = vm.Notes;
         type.IsRemedial     = vm.IsRemedial;
         type.IsDisciplinary = vm.IsDisciplinary;
         type = this.actionTakenTasks.SaveActionTakenType(type);
         return(RedirectToAction("Details", new { id = type.Id }));
     }
     return(Create());
 }
Ejemplo n.º 6
0
        public ActionResult Delete(int id)
        {
            ActionTakenType type = this.actionTakenTasks.GetActionTakenType(id);

            if (type != null)
            {
                if (this.actionTakenTasks.DeleteActionTakenType(type))
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(RedirectToAction("Details", new { id = id }));
                }
            }
            return(new HttpNotFoundResult());
        }
Ejemplo n.º 7
0
        public ActionResult Edit(ActionTakenTypeViewModel vm)
        {
            ActionTakenType         type  = this.actionTakenTasks.GetActionTakenType(vm.Id);
            IList <ActionTakenType> types = this.actionTakenTasks.GetActionTakenTypesByName(vm.ActionTakenTypeName);

            if (type != null && types != null && types.Any() && types.Where(x => x.Id != type.Id).Any())
            {
                ModelState.AddModelError("ActionTakenTypeName", "Action taken type already exists.");
            }
            if (ModelState.IsValid)
            {
                type.ActionTakenTypeName = vm.ActionTakenTypeName;
                type.Notes          = vm.Notes;
                type.IsRemedial     = vm.IsRemedial;
                type.IsDisciplinary = vm.IsDisciplinary;
                type = this.actionTakenTasks.SaveActionTakenType(type);
                return(RedirectToAction("Details", new { id = vm.Id }));
            }
            return(Edit(vm.Id));
        }
Ejemplo n.º 8
0
 public ActionTakenType SaveActionTakenType(ActionTakenType type)
 {
     return(this.actionTakenTypeRepo.SaveOrUpdate(type));
 }