public IActionResult Update(SerieDTO serieDTO, int Id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorMessage()));
            }

            else
            {
                IDataResult <Serie> dataResult = _service.GetById(Id);

                if (dataResult == null)
                {
                    return(BadRequest(dataResult.Message));
                }

                else
                {
                    mapper = SerieMapping.GetMapper().CreateMapper();

                    Serie serie = mapper.Map <SerieDTO, Serie>(serieDTO);

                    IResult result = _service.Update(serie);

                    if (result.Success)
                    {
                        return(Ok(result.Message));
                    }

                    return(BadRequest(result.Message));
                }
            }
        }
        public ActionResult SerieEdit(string serieId, string editAction)
        {
            SerieDTO serieDTO = new SerieDTO();

            Dictionary <string, object>  parameters = new Dictionary <string, object>();
            List <DocumentoComercialDTO> documentoComercialDTOList = documentoComercialService.SearchFor(parameters, string.Empty);

            ViewBag.DocumentoList = WebHelper.ToSelectListItem <DocumentoComercialDTO>(
                documentoComercialDTOList, x => x.DocumentoComercialId.ToString(), x => x.Nombre, SelectListFirstElementType.Select, string.Empty);

            switch (editAction)
            {
            case EditActionConstant.NEW:
                break;

            case EditActionConstant.EDIT:
                serieDTO = serieService.GetById(Convert.ToInt32(serieId));
                break;
            }

            return(PartialView(serieDTO));
        }
Beispiel #3
0
 // GET: Serie/Details/5
 public ActionResult Details(int id)
 {
     return(View(Mapper.Map <Serie, SerieModelView>(_serieService.GetById(id))));
 }