public PreciosViewModel DomainToVIewModel(TbPrPrecios domain) { return(new PreciosViewModel { Id = domain.Id, Descripcion = domain.Descripcion, Nombre = domain.Nombre, Fecha = domain.Fecha, IdUsuario = (int)domain.IdUsuario }); }
public ActionResult CrearEditarPrecios(PreciosViewModel viewModel) { try { var existePre = service.GetPreciosByDesc(viewModel.Id); var Precios = new TbPrPrecios(); if (viewModel.Id != 0) { if (existePre.Id == viewModel.Id) { Precios = map.Update(viewModel); } else { return(Json(new { success = false })); } } else { if (existePre == null) { viewModel.IdUsuario = int.Parse(User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value); Precios = map.Create(viewModel); var idTipoPrecio = (int)Precios.Id; var inventarios = inventarioService.GetAll(); var resultado = precioCatalogoService.SaveFromPrecios(idTipoPrecio); } else { return(Json(new { success = false })); } } return(Json(new { success = true, precios = Precios })); } catch (Exception ex) { AltivaLog.Log.Insertar(ex.ToString(), "Error"); throw; } }
public TbPrPrecios Update(TbPrPrecios domain) { return(reposistory.Update(domain)); }
public TbPrPrecios Save(TbPrPrecios domain) { return(reposistory.Save(domain)); }