Example #1
0
 /// <summary>
 /// 增加
 /// </summary>
 /// <returns></returns>
 public ActionResult Add(WST.Model.PinTuan entity)
 {
     ModelState.Remove("ID");
     ModelState.Remove("UpdatedTime");
     ModelState.Remove("CreatedTime");
     if (ModelState.IsValid)
     {
         entity.CreatedTime = entity.UpdatedTime = DateTime.Now;
         var result = IPinTuanService.Add(entity);
         return(JResult(result));
     }
     else
     {
         return(ParamsErrorJResult(ModelState));
     }
 }
Example #2
0
        /// <summary>
        /// 增加
        /// </summary>
        /// <returns></returns>
        public ActionResult Update(WST.Model.PinTuan entity)
        {
            ModelState.Remove("UpdatedTime");
            ModelState.Remove("CreatedTime");
            if (ModelState.IsValid)
            {
                var model = IPinTuanService.Find(entity.ID);
                if (model == null || (model != null && model.IsDelete))
                {
                    return(DataErorrJResult());
                }

                if (IPinTuanService.IsExits(x => x.Name == entity.Name && x.ID != entity.ID))
                {
                    return(JResult(Core.Code.ErrorCode.system_name_already_exist, ""));
                }

                model.Name         = entity.Name;
                model.Picture      = entity.Picture;
                model.StartTime    = entity.StartTime;
                model.EndTime      = entity.EndTime;
                model.Amount       = entity.Amount;
                model.IsNeedPay    = entity.IsNeedPay;
                model.IsNeedReport = entity.IsNeedReport;
                model.Connact      = entity.Connact;
                model.Rules        = entity.Rules;
                model.MusicUrl     = entity.MusicUrl;
                model.FunctionName = entity.FunctionName;
                var result = IPinTuanService.Update(model);
                return(JResult(result));
            }
            else
            {
                return(ParamsErrorJResult(ModelState));
            }
        }