示例#1
0
        public async Task <DataAPIResult <RoleInfo> > Add(RoleInfo role)
        {
            var result = new DataAPIResult <RoleInfo>();

            result = await service.Add(role);

            return(result);
        }
        public async Task <IActionResult> AddRoleInfo(RoleInfo roleInfo)
        {
            roleInfo.RoleId  = Guid.NewGuid().ToString();
            roleInfo.SetTime = DateTime.Now;
            //  var res = _EFCoreService.AddRoleInfo(roleInfo);
            var res = await _roleInfoService.Add(roleInfo);

            return(new JsonResult(new Result {
                Data = res, Msg = $"添加角色{(res ? "成功" : "失败")}", Status = res ? 200 : 204
            }));
        }
示例#3
0
 public ActionResult AddRoleInfo(RoleInfo roleInfo)
 {
     roleInfo.SubTime  = DateTime.Now;
     roleInfo.ModifyOn = DateTime.Now;
     roleInfo.DelFlag  = NoDel;
     if (ModelState.IsValid)
     {
         roleInfoService.Add(roleInfo);
         return(Content("ok"));
     }
     return(Content("error"));
 }
示例#4
0
 public ActionResult Add(RoleInfo ri)
 {
     try
     {
         // TODO: Add insert logic here
         ri.SubTime = DateTime.Now;
         roleInfoService.Add(ri);
         return(Content("ok"));
     }
     catch
     {
         return(View());
     }
 }
示例#5
0
 public ActionResult Edit(RoleInfo roleInfo)
 {
     if (string.IsNullOrEmpty(roleInfo.ID))
     {
         roleInfo.ID        = TableIDCodingRule.newID("roleinfo", "");
         roleInfo.ModfiedOn = DateTime.Now;
         roleInfo.SubTime   = DateTime.Now;
         roleInfo.DelFlag   = (short)DelFlagEnum.Normal;
         if (!ModelState.IsValid)
         {
             return(View());
         }
         roleInfoService.Add(roleInfo);
     }
     else
     {
         if (!ModelState.IsValid)
         {
             return(View());
         }
         roleInfoService.Update(roleInfo);
     }
     return(View("Index"));
 }