public async Task <IHttpActionResult> EditDropZone(DropZoneModel model) { try { var result = await _dropZoneManager.EditDropZoneAsync(model); return(Ok(result)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public async Task <DropZoneModel> CreateDropZoneAsync(DropZoneModel model, string adminEmail) { var admin = await _userService.GetUserAsync(adminEmail); var adminRole = await _userService.GetAdminRoleAsync(); if (admin.RoleId == adminRole.Id) { throw new Exception($"User with email {adminEmail} is already admin of another dropzone"); } admin.RoleId = adminRole.Id; var result = await _dropZoneService.CreateDropZoneAsync(model); admin.DropZoneId = result.Id; await _userService.EditUserAsync(Mapper.Map <UserModel>(admin)); return(result); }
public async Task <DropZoneModel> EditDropZoneAsync(DropZoneModel model) { var result = await _dropZoneService.EditDropZoneAsync(model); return(result); }