Ejemplo n.º 1
0
        public async Task <bool> Update(ArticleNoDto model)
        {
            var articleNo = _mapper.Map <ArticleNo>(model);

            _repoArticalNo.Update(articleNo);
            return(await _repoArticalNo.SaveAll());
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> Update(ArticleNoDto update)
 {
     if (await _articleNoService.Update(update))
     {
         return(NoContent());
     }
     return(BadRequest($"Updating the article no {update.ID} failed on save"));
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create(ArticleNoDto create)
        {
            if (_articleNoService.GetById(create.ID) != null)
            {
                return(BadRequest("Article ID already exists!"));
            }
            create.CreatedDate = DateTime.Now;
            if (await _articleNoService.Add(create))
            {
                return(NoContent());
            }

            throw new Exception("Creating the article no failed on save");
        }