public ActionResult <WlogHistoryReadDto> CreateAccount(int id, WlogHistoryCreateDto acc) { var wlogHistoryModel = _mapper.Map <WlogHistory>(acc); _repository.Add(wlogHistoryModel); _repository.Save(); var readDto = _mapper.Map <WlogHistoryReadDto>(wlogHistoryModel); return(CreatedAtRoute(nameof(GetWlogHistoryById), new { id = wlogHistoryModel.ID }, readDto)); }
public ActionResult <WlogReadDto> UpdateWlog(int id, WlogUpdateDto dto) { var oldWlog = _repository.Find(id); if (oldWlog == null) { return(NotFound()); } _wlogHistoryRepository.Add(new WlogHistory() { Wlog = oldWlog, Content = oldWlog.PublishedContent }); _wlogHistoryRepository.Save(); _mapper.Map(dto, oldWlog); _repository.Save(); return(NoContent());// Ok(oldAcc); }