public async Task <IActionResult> Upsert(int?id) { IEnumerable <Marca> npList = await _npRepo.GetAllAsync(SD.MarcaAPIPath, HttpContext.Session.GetString("JWToken")); PatrimoniosVM objVM = new PatrimoniosVM() { MarcasList = npList.Select(i => new SelectListItem { Text = i.Nome, Value = i.Id.ToString() }), Patrimonio = new Patrimonio() }; if (id == null) { //Insert Or create return(View(objVM)); } objVM.Patrimonio = await _npPatrimonio.GetAsync(SD.PatrimonioAPIPath, id.GetValueOrDefault(), HttpContext.Session.GetString("JWToken")); if (objVM.Patrimonio == null) { //Edit or Update return(NotFound()); } return(View(objVM)); }
public async Task <IActionResult> GetAllMarcas() { //WorkFlow var model = await _npRepo.GetAllAsync(SD.MarcaAPIPath, HttpContext.Session.GetString("JWToken")); return(Json(new { data = model })); }
public async Task <IActionResult> Index() { IndexVM model = new IndexVM() { MarcaList = await _npRepo.GetAllAsync(SD.MarcaAPIPath, HttpContext.Session.GetString("JWToken")), PatrimonioList = await _npTrail.GetAllAsync(SD.PatrimonioAPIPath, HttpContext.Session.GetString("JWToken")) }; return(View(model)); }