public ActionResult <Phone> PostCreatePhone(Phone value) { _shopService.CreatePhonesAPI(value); _shopService.Commit(); return(CreatedAtAction(nameof(GetPhonesAPI), new { id = value.PhoneID }, value)); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _cache.Remove("PhoneKey"); await _shopservice.CreatePhone(Phone); await _shopservice.Commit(); TempTest = Phone.PhoneName + " Blev oprettet"; return(RedirectToPage("/Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Phone = await _shopservice.FindPhone(id); if (Phone != null) { _shopservice.RemovePhone(Phone); await _shopservice.Commit(); } return(RedirectToPage("./Index")); }