public IActionResult Edit(int id) { var viewModel = Mapper.Map <CajasEditViewModel>(_cajas.GetById(id)); viewModel.Sucursales = _sucursales.GetAll().Select(x => new DropDownViewModel <int>() { Text = x.Nombre, Value = x.Id }).ToList(); return(View(viewModel)); }
public async Task <SystemValidationModel> SaveApertura(string model) { var viewModel = JsonConvert.DeserializeObject <AddCajaAperturaViewModel>(model); var result = _cajaAperturaCierre.SaveApertura(viewModel); if (result.Success && viewModel.Tipo == CajaTipoOperacion.Apertura) { var usuario = _usuarios.GetForLogin(Email); var caja = _cajas.GetById(viewModel.CajaId); var claims = new ClaimsIdentity(SecurityHelper.GetUserClaims(usuario, usuario.Sucursal, caja, result.Id), "Cookie"); await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(claims)); } return(result); }