Пример #1
0
 public PlanDto(Plan plan)
 {
     this.PlanId = plan.PlanId;
     this.PlanName = plan.PlanName;
     this.AddedDate = plan.AddedDate;
     this.ChangedDate = plan.ChangedDate;
     this.Description = plan.Description;
     this.IsDone = plan.IsDone;
 }
Пример #2
0
 public ActionResult UpdatePlan(Plan plan)
 {
     try
     {
         var helper = new IocHelper();
         helper.PlanService.UpdatePlan(plan);
         return Json(plan, JsonRequestBehavior.AllowGet);
     }
     catch (Exception e)
     {
         throw new HttpException(500, e.Message);
     }
 }
Пример #3
0
 public ActionResult DeletePlan(int id)
 {
     try
     {
         var plan = new Plan{PlanId = id};
         var helper = new IocHelper();
         helper.PlanService.DeletePlan(plan);
         return Json(true, JsonRequestBehavior.AllowGet);
     }
     catch (Exception e)
     {
         throw new HttpException(500, e.Message);
     }
 }
Пример #4
0
 public ActionResult SavePlan(Plan plan)
 {
     try
     {
         plan.AddedDate = DateTime.Now;
         plan.IsDone = false;
         var helper = new IocHelper();
         helper.PlanService.SavePlan(plan);
         return Json(plan, JsonRequestBehavior.AllowGet);
     }
     catch (Exception e)
     {
         throw new HttpException(500, e.Message);
     }
 }
Пример #5
0
 public void SetUp()
 {
     rep = new PlanXmlRepository();
     _plan = new Plan
     {
         PlanName = "Create plan",
         AddedDate = DateTime.Now,
         Description = "Create plan",
         PossibleChangeDate = default(DateTime),
         IsDone = false
     };
 }
Пример #6
0
 public void SavePlan(Plan article)
 {
     var match = _repository.GetAll(null).FirstOrDefault(c => c.PlanName == article.PlanName);
     //var res = _repository.GetByPredicate(c => c.PlanName == article.PlanName,null);
     if (match == null)
     {
         article.PlanId = _repository.Save(article);
     }
     else
     {
         throw new Exception(string.Format("План с названием \"{0}\" уже существует",article.PlanName));
     }
 }
Пример #7
0
 public void DeletePlan(Plan plan)
 {
     _repository.Delete(plan);
 }
Пример #8
0
 public void UpdatePlan(Plan plan)
 {
     plan.PlanId = _repository.Update(plan);
 }