public async Task <IActionResult> Create([Bind("Id,From,To,Value")] DataEntry dataEntry) { if (ModelState.IsValid) { await _context.Add(dataEntry); return(RedirectToAction(nameof(Index))); } return(View(dataEntry)); }
public async Task <IActionResult> Create([FromBody] DataEntry dataEntry) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // var dataEntry = _mapper.Map<DataEntry>(dataEntry); dataEntry = await _dataentryRepository.Add(dataEntry); await _unitOfWork.CompleteAsync(); return(Ok(dataEntry)); }