public async Task <IActionResult> Edit(PostTypesViewModel model) { var postTask = await client.PostAsJsonAsync($"{uri}api/posttypes/posttypeid={model.PostTypeId}", model); if (postTask.IsSuccessStatusCode) { return(RedirectToAction("Index")); } return(View()); }
public async Task <IActionResult> Edit(int?id) { var postType = new PostTypesViewModel(); HttpResponseMessage res = await client.GetAsync($"{uri}api/posttypes/{id}"); if (res.IsSuccessStatusCode) { var result = res.Content.ReadAsStringAsync().Result; postType = JsonConvert.DeserializeObject <PostTypesViewModel>(result); } return(View(postType)); }
public PostTypesViewModel GetDetail(int?id) { var postType = _context.PostTypes.Find(id); PostTypesViewModel p = new PostTypesViewModel() { PostTypeId = postType.PostTypeId, PostTypeName = postType.PostTypeName, CreatedDate = postType.CreatedDate, ModifiedDate = postType.ModifiedDate, SortOrder = postType.SortOrder, }; return(p); }