Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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);
        }