public async Task <ActionResult> Edit([Bind(Include = "FooterID,Contain,Status,FooterIDType,FooterParentID,Link,Target")] FooterDTO footer)
        {
            if (ModelState.IsValid)
            {
                //client.BaseAddress = new Uri(apiBaseAddress);
                var response = await client.PutAsJsonAsync("api/Footers/FooterID=" + footer.FooterID, footer);

                if (response.IsSuccessStatusCode)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Error");
                }
                return(RedirectToAction("Index"));
            }
            return(View(footer));
        }
        public async Task <ActionResult> Create(FooterDTO footer)
        {
            int key = ctrl.autoKey();

            try
            {
                if (ModelState.IsValid)
                {//FooterID,Contain,Status,FooterIDType,FooterParentID,Link,Target
                    var foot = new FooterDTO();
                    foot.FooterID       = key;
                    foot.Contain        = footer.Contain;
                    foot.Status         = footer.Status;
                    foot.FooterIDType   = footer.FooterIDType;
                    foot.FooterParentID = footer.FooterParentID;
                    foot.Link           = footer.Link;
                    foot.Target         = "_self";
                    HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url + "/Footers", foot);

                    if (responseMessage.IsSuccessStatusCode)
                    {
                        //var responseData = responseMessage.Content.ReadAsStringAsync().Result;
                        var settings = new JsonSerializerSettings
                        {
                            NullValueHandling     = NullValueHandling.Ignore,
                            MissingMemberHandling = MissingMemberHandling.Ignore
                        };
                    }
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception)
            {
                ModelState.AddModelError("", "Error");
            }
            return(View(footer));
        }
 //xóa footer
 public bool Delete(FooterDTO footer)
 {
     return(bus.Delete(footer));
 }
 //sửa footer
 public bool Update(FooterDTO footer)
 {
     return(bus.Update(footer));
 }
 //thêm footer
 public bool Insert(FooterDTO item)
 {
     return(bus.Insert(item));
 }
Beispiel #6
0
 public bool DeleteProductType(FooterDTO item)
 {
     return(footerRepository.Delete(item));
 }
Beispiel #7
0
 public bool PutProductType(FooterDTO item)
 {
     return(footerRepository.Update(item));
 }
Beispiel #8
0
 public bool PostProduct(FooterDTO item)
 {
     return(footerRepository.Insert(item));
 }