예제 #1
0
 public async Task <IActionResult> Save([FromBody] ColheitaViewModel model)
 {
     try
     {
         return(Ok(await _ColheitaService.Insert(_mapper.Map <Colheita>(model))));
     }
     catch (Exception e) {
         return(BadRequest(e.Message));
     }
 }
예제 #2
0
        public async Task <IActionResult> Delete([FromBody] ColheitaViewModel model)
        {
            try
            {
                var Colheita = await _ColheitaService.GetSingle(x => x.Id == model.Id, true);

                if (Colheita == null)
                {
                    return(NotFound());
                }

                return(Ok(await _ColheitaService.Delete((long)model.Id)));
            }
            catch (Exception e) {
                return(BadRequest(e.Message));
            }
        }