public async Task <ActionResult <ICollection <List> > > Post([FromBody] List model) { try { var userName = this.User.Identity.Name; var user = await _userManager.FindByEmailAsync(userName); if (this.User.Identity.IsAuthenticated && userName != null) { // call repo here, pass model var result = _listRepository.CreateList(model, userName, user); // save all fixes the model so that it contains the id from the database. //return Created($"/api/lists/{model.Id}", model); return(Created($"/api/lists", result)); } else { return(this.StatusCode(StatusCodes.Status401Unauthorized, "Unauthorized request")); } } catch (Exception ex) { _logger.LogError($"Failed to create new list: {ex}"); return(this.StatusCode(StatusCodes.Status500InternalServerError, "Database Failure, list was not created")); } }
public async Task CreateList(string boardId, List list) { if (list.ListCards == null) { list.ListCards = new List <Card>(); } await listRepository.CreateList(boardId, list); }
/// <summary> /// /// </summary> /// <param name="Lists"></param> /// <returns></returns> public bool CreateList(ListDTO Lists) { var result = false; TblList list = _mapper.Map <TblList>(Lists); result = _listRepository.CreateList(list); return(result); }
/// <summary> /// /// </summary> /// <param name="Lists"></param> /// <returns></returns> public ListDTO CreateList(ListDTO Lists) { TblList list = _mapper.Map <TblList>(Lists); list.CreatedDate = DateTime.UtcNow; list.ListId = Guid.NewGuid().ToString(); list = _listRepository.CreateList(list); ListDTO listdto = _mapper.Map <ListDTO>(list); return(listdto); }
public ActionResult Post([FromBody] ListDTO list) { try { var result = list_repo_.CreateList(list); return(this.Ok(result)); } catch (Exception ex) { throw ex; } }
public ListDto CreateList(AddListDto listDto, string userId) { if (!_boardRepository.IsOwner(listDto.BoardId, userId)) { return(null); } var list = _mapper.Map <List>(listDto); var position = _listRepository.GetNumberOfListsInBoard(listDto.BoardId) + 1; list.Position = position; var addedList = _listRepository.CreateList(list); var result = _mapper.Map <ListDto>(addedList); return(result); }
public IActionResult CreateList(string title) { _listRepository.CreateList(temp_uid, title); return(Redirect("~/Dashboard/")); }
public ToDoList CreateNewList(ToDoList toDoList) { return(_listRepo.CreateList(toDoList)); }