public async Task <UserTypeDTO> UserTypeDelete(UserTypeDTO userTypeDTO) { var dataObject = userTypeDTO as UserType; _sqlServerContext.Remove <UserType>(dataObject); await _sqlServerContext.SaveChangesAsync(); return(userTypeDTO); }
public void OnAuthorization(AuthorizationContext filterContext) { UserTypeDTO currentUserType = SessionCache.UserType; if (!acceptedUsers.Contains(currentUserType)) { throw new Exception("UnAuthorised"); } }
public static void CreateSession(int userId, string userEmail, List <MenuDTO> userMenus, UserTypeDTO userType) { UserId = userId; UserEmail = userEmail; LoginFailCount = 0; UserMenus = userMenus; UserType = userType; }
public async Task <UserTypeDTO> UserTypeEntryUpdate(UserTypeDTO userTypeDTO) { var dataObject = userTypeDTO as UserType; if (userTypeDTO.UserTypeId == 0) { await _sqlServerContext.AddAsync <UserType>(dataObject); } else { _sqlServerContext.Update <UserType>(dataObject); } await _sqlServerContext.SaveChangesAsync(); return(userTypeDTO); }
public async Task <IActionResult> UserTypeDelete([FromBody] UserTypeDTO userTypeDTO) { var response = new SingleResponseModel <UserTypeDTO>(); try { var data = await _userTypeService.UserTypeDelete(userTypeDTO); response.Model = data; } catch (Exception ex) { response.DidError = true; response.ErrorMessage = "There was an internal error, please contact to technical support."; } return(response.ToHttpResponse()); }
public async Task <UserTypeDTO> UserTypeEntryUpdate(UserTypeDTO userTypeDTO) { return(await _userTypeRepository.UserTypeEntryUpdate(userTypeDTO)); }
public void Delete(UserTypeDTO obj) { userTypeRepository.Delete(Mapper.Map <UserTypeDTO, UserType>(obj)); }
public void Save(UserTypeDTO obj) { userTypeRepository.Save(Mapper.Map <UserTypeDTO, UserType>(obj)); }