Esempio n. 1
0
        public async Task <IActionResult> Put(long accountid, long id, [FromBody] EntryViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var entry  = _mapper.Map <Entry>(viewModel);
                var result = await _repo.SaveEntryAsync(accountid, id, entry);

                if (result > 0)
                {
                    return(Created("", viewModel));
                }
                else
                {
                    return(NotFound());
                }
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }