예제 #1
0
 public async Task <ActionResult> SaveUserGroup(UserGroupViewModel model)
 {
     if (ModelState.IsValid)
     {
         if (string.IsNullOrEmpty(model.Id))
         {
             model.Id = Guid.NewGuid().ToString("N");
             var insertGroup = model.ProjectTo <Angelo.Connect.Models.UserGroup>();
             await _userGroupManager.InsertUserGroupAsync(insertGroup);
         }
         else
         {
             var updateGroup = model.ProjectTo <Angelo.Connect.Models.UserGroup>();
             await _userGroupManager.UpdateUserGroupAsync(updateGroup);
         }
         return(Ok(model));
     }
     return(BadRequest(ModelState));
 }