public void SetCorpInfo(CorpInfo info) { using (AnanEntities db = new AnanEntities()) { List<CorpInfo> infos = (from ci in db.CorpInfo orderby ci.ID descending select ci).ToList<CorpInfo>(); if (infos.Count > 0) { info.ID = infos[0].ID; UpdateProperties(infos[0], info); } else { db.CorpInfo.Add(info); } db.SaveChanges(); } }
public JsonResult SaveSiteInfo() { JsonResult res = new JsonResult(); JsonMessage message = new JsonMessage() { Status="ok",Message=""}; User user = (User)Session["User"]; BaseManager manager = new BaseManager(user); try { string title = Request["title"]; string about = Request["about"]; string contact = Request["contact"]; string team = Request["team"]; string shipping = Request["shipping"]; string backsale=Request["backsale"]; CorpInfo info = new CorpInfo(); info.Team = team; info.About = about; info.Contact = contact; info.Title = title; info.BackSale = backsale; info.Shipping = shipping; manager.SetCorpInfo(info); res.Data = message; } catch (Exception ex) { } return res; }