public async Task <IActionResult> Create(StatusCreateDto teamDto) { if (await _teamService.CheckExists(teamDto.ID)) { return(BadRequest("Status ID already exists!")); } //var username = User.FindFirst(ClaimTypes.Name).Value; //glueIngredientDto.Updated_By = username; if (await _teamService.Add(teamDto)) { return(NoContent()); } throw new Exception("Creating the team failed on save"); }
public async Task <bool> Add(StatusCreateDto model) { try { var cat = _mapper.Map <Status>(model); _repoStatus.Add(cat); await _repoStatus.SaveAll(); var langs = model.Langs.Select(x => new StatusLang { StatusID = cat.StatusID, Name = x.Name, LanguageID = x.LanguageID }).ToList(); await _repoStatus.AddStatusLang(langs); return(true); } catch (Exception ex) { return(false); } }
public Task <bool> Update(StatusCreateDto model) { throw new NotImplementedException(); }