public async Task <ActionResult> DeleteComics(ComicsDTO comicsDTO) { var cs = await _comicsManager.Get(); var comics = cs.Where(x => x.Id == comicsDTO.Id).FirstOrDefault(); await _comicsManager.Delete(comics); return(Ok()); }
public async Task Update(ComicsDTO comicsDTO) { try { Comics comics = _mapper.Map <ComicsDTO, Comics>(comicsDTO); _comicsRepository.Update(comics); await _comicsRepository.Save(); } catch (Exception ex) { _loger.LogError(ex.Message); } }
public async Task Delete(ComicsDTO comicsDTO) { try { Comics com = await _comicsRepository.Get(comicsDTO.Id); _comicsRepository.Delete(com); await _comicsRepository.Save(); } catch (Exception ex) { _loger.LogError(ex.Message); } }
public async Task Insert(ComicsDTO comicsDTO) { try { Comics comics = _mapper.Map <ComicsDTO, Comics>(comicsDTO); comics.DateCreated = DateTime.Now; comics.DateModified = DateTime.Now; await _comicsRepository.Insert(comics); await _comicsRepository.Save(); } catch (Exception ex) { _loger.LogError(ex.Message); } }
//[Authorize(Roles = "ComicsSeller")] public async Task <ActionResult> UpdateComics(ComicsDTO comicsDTO) { await _comicsManager.Update(comicsDTO); return(Ok()); }
//[Authorize(Roles ="ComicsSeller")] public async Task <ActionResult> CreateComics(ComicsDTO comicsDTO) { await _comicsManager.Insert(comicsDTO); return(Ok()); }