Exemplo n.º 1
0
 public IActionResult EditBucket(BucketMapping model)
 {
     if (!String.IsNullOrEmpty(model.id))
     {
         _bucketService.UpdateBucket(model, UserId);
         AjaxData.Message = "修改成功";
     }
     else
     {
         var entity = _mapper.Map <Entities.bucket>(model);
         entity.id            = CombGuid.NewGuidAsString();
         entity.creator       = UserId;
         entity.creation_time = DateTime.Now;
         _bucketService.AddBucket(entity);
         AjaxData.Message = "添加成功";
     }
     AjaxData.Success = true;
     return(Json(AjaxData));
 }
Exemplo n.º 2
0
 public IActionResult OnPost()
 {
     if (!ModelState.IsValid)
     {
         return(NotValid());
     }
     (bool Status, string Message)res;
     if (Bucket.Id != Guid.Empty)
     {
         res = _bucketService.UpdateBucket(Bucket, UserId);
     }
     else
     {
         var item = _mapper.Map <Entities.Bucket>(Bucket);
         item.Id           = CombGuid.NewGuid();
         item.CreationTime = DateTime.Now;
         item.Creator      = UserId;
         res = _bucketService.AddBucket(item);
     }
     AjaxData.Message = res.Message;
     AjaxData.Code    = res.Status ? 0 : 2001;
     return(Json(AjaxData));
 }