DocSas/PropertyService.Domain/ModelView/Staffs/StaffProvider.cs
/// <summary>
/// save role staff as an asynchronous operation.
/// </summary>
/// <param name="staffVM">The staff vm.</param>
/// <returns>Task&lt;DSCResponse&gt;.</returns>
save role staff as an asynchronous operation.
save role staff as an asynchronous operation .
public async Task<DSCResponse> SaveRoleStaffAsync(StaffRoleForm staffVM)
        {
            var msg = new Dictionary<string, string>();
            var response = new DSCResponse();
            var issuccess = false;
                var management = await _appCommon.GetManagementUserAsync(staffVM.UserId);
                if (management != null)
                {
                  var stRole = new List<StaffRole>();
                  foreach (var item in staffVM.StaffRoleInput)
                  {
                    stRole.Add(new StaffRole() { RoleId = staffVM.RoleId, StaffId= item.Id, UserId = item.UserId, IsValid = true, AddedDateUtc = DateTime.UtcNow, ModifiedDateUtc = DateTime.UtcNow });
                  }
                await _staffRoleRepo.AddAsync(stRole);
                    issuccess = true;
                }
            response.ResponseData = issuccess;
            response.ErrorMessage = msg;
            return response;
        }
public async Task < DSCResponse > SaveRoleStaffAsync ( StaffRoleForm staffVM ) { var msg = new Dictionary < string , string > ( ) ; var response = new DSCResponse ( ) ; var issuccess = false ; var management = await _appCommon . GetManagementUserAsync ( staffVM . UserId ) ; if ( management != null ) { var stRole = new List < StaffRole > ( ) ; foreach ( var item in staffVM . StaffRoleInput ) { stRole . Add ( new StaffRole ( ) { RoleId = staffVM . RoleId , StaffId = item . Id , UserId = item . UserId , IsValid = true , AddedDateUtc = DateTime . UtcNow , ModifiedDateUtc = DateTime . UtcNow } ) ; } await _staffRoleRepo . AddAsync ( stRole ) ; issuccess = true ; } response . ResponseData = issuccess ; response . ErrorMessage = msg ; return response ; }
save role staff as an asynchronous operation.
save role staff as an asynchronous operation .
None
staffVM
StaffRoleForm
The staff vm.
The staff vm .