Exemple #1
0
        public ActionResult Create(PlanLogViewModel model)
        {
            ServiceResult result = new ServiceResult();
            if (ModelState.IsValid)
            {
                try
                {
                    PlanLogService.Create(model);
                    result.Message = "添加PlanLog成功!";
                    LogHelper.WriteLog("添加PlanLog成功");
                }
                catch (Exception ex)
                {
                    result.Message = Utilities.GetInnerMostException(ex);
                    result.AddServiceError(result.Message);
                    LogHelper.WriteLog("添加PlanLog错误", ex);
                }
            }
            else
            {
                result.Message = "请检查表单是否填写完整!";
                result.AddServiceError("请检查表单是否填写完整!");

            }

            return Json(result);
        }
Exemple #2
0
 public PlanLog Create(PlanLogViewModel model)
 {
     PlanLog entity = new PlanLog();
     entity.AddTime = DateTime.Now;
     entity.AddUser = 227;
     entity.CompanyID = model.CompanyID;
     entity.Content = model.Content;
     entity.PlanTime = model.PlanTime;
     entity.CommentTitme = DateTime.Now.AddMonths(1);
     db.Add<PlanLog>(entity);
     db.Commit();
     return entity;
 }
Exemple #3
0
 public ActionResult Create()
 {
     var model = new PlanLogViewModel();
     return PartialView(model);
 }
Exemple #4
0
 public ActionResult Edit(int ID)
 {
     var entity = PlanLogService.Find(ID);
     var model = new PlanLogViewModel()
     {
         CompanyID = entity.CompanyID,
         ID = entity.ID,
         Content = entity.Content
     };
     return PartialView(model);
 }
Exemple #5
0
 public PlanLog Update(PlanLogViewModel model)
 {
     PlanLog entity = Find(model.ID);
     db.Attach<PlanLog>(entity);
     entity.Content = model.Content;
     entity.PlanTime = model.PlanTime;
     db.Commit();
     return entity;
 }