public JsonResult EditList(List list) { 
     //odredi je li novi ili edit
     //svakako spremi u bazu
     //to je to
     System.Diagnostics.Debug.WriteLine("ajmoo "+ list);
     List edited = context.Lists.FirstOrDefault(x => x.ListID == ListID);
     edited.ListName = list.ListName;
     context.SaveChanges();
     return Json("");
 
 }
        public JsonResult CreateList(List list) {
            if (ModelState.IsValid) {
                //Kreiranu listu spremi useru!
                People user = context.People.FirstOrDefault(x => x.UserID == UserID);               
                list.User = user;
                context.Lists.Add(list);
                context.SaveChanges();

                return Json("super");
            }

            return Json("Provide List Name");
        }
        //
        // GET: /Private/
        
        public ActionResult Index()
        {
            //Find userID from cookie
            string encryptedCookie = Request.Cookies[FormsAuthentication.FormsCookieName].Value;
            FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(encryptedCookie);
            UserID = Int32.Parse(ticket.UserData);
            //Find users lists
            IEnumerable<List> myLists = new List<List>();            
            myLists = context.Lists.Where(x => x.User.UserID == UserID).ToList<List>();

           
            //Send lists to view
            return View((object)myLists);
        }
 public Item_List_ViewModel() {
     List = new List();
 }
Exemplo n.º 5
0
 public List() {
     Items = new List<Item>();
 }