Example #1
0
        public ActionResult Create([Bind(Include = "GapStart,GapEnd")] GapsTable gapsTable)
        {
            if (ModelState.IsValid)
            {
                db.GapsTables.Add(gapsTable);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(gapsTable));
        }
        public ActionResult Create([Bind(Include = "levelId,userId,userLevel1,xp,xpNeeded")] UserLevel userLevel)
        {
            if (ModelState.IsValid)
            {
                db.UserLevels.Add(userLevel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.userId = new SelectList(db.AspNetUsers, "Id", "Email", userLevel.userId);
            return(View(userLevel));
        }
        public ActionResult Create([Bind(Include = "eventId,userId,interestId,summary,description,location,colorId,starttime,endtime,recurrence,reminders,completed")] Event @event)
        {
            if (ModelState.IsValid)
            {
                db.Events.Add(@event);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.interestId = new SelectList(db.Interests, "interestId", "userId", @event.interestId);
            ViewBag.userId     = new SelectList(db.AspNetUsers, "Id", "Email", @event.userId);
            return(View(@event));
        }
        public ActionResult Create([Bind(Include = "interestId,userId,title,weeklygoal,minTime,priority,colorId")] Interest interest)
        {
            if (ModelState.IsValid)
            {
                db.Interests.Add(interest);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.interestId = new SelectList(db.Progresses, "progressId", "userId", interest.interestId);
            ViewBag.userId     = new SelectList(db.AspNetUsers, "Id", "Email", interest.userId);
            return(View(interest));
        }
        public ActionResult Create([Bind(Include = "progressId,userId,interestId,total,endDate")] Progress progress)
        {
            if (ModelState.IsValid)
            {
                db.Progresses.Add(progress);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.progressId = new SelectList(db.Interests, "interestId", "userId", progress.progressId);
            ViewBag.userId     = new SelectList(db.AspNetUsers, "Id", "Email", progress.userId);
            return(View(progress));
        }
Example #6
0
        public JsonResult GetUserEventInfo(EventsController events)
        {
            //var today = DateTime.Now.ToString();

            DateTime startDateResult;
            DateTime endDateResult;


            string summary     = events.EventSummary;
            string location    = events.EventLocation;
            string description = events.EventDescription;
            string startTime   = events.EventStart;

            string endTime    = events.EventEnd;
            string recurrence = events.EventRecurrence;
            bool   reminders  = false;
            string color      = events.EventColor;

            Event newEvent = new Event();

            newEvent.userId   = "c03d4c0a-ee82-4980-ad00-bb4cb16f99ca";
            newEvent.summary  = summary;
            newEvent.location = location;
            if (description != null && description.Length > 500)
            {
                newEvent.description = description.Substring(0, 500);
            }
            else
            {
                newEvent.description = description;
            }
            DateTime.TryParse(startTime, out startDateResult);
            newEvent.starttime = startDateResult;
            DateTime.TryParse(endTime, out endDateResult);
            newEvent.endtime    = endDateResult;
            newEvent.recurrence = recurrence;
            newEvent.reminders  = reminders;
            newEvent.colorId    = color;
            db.Events.Add(newEvent);
            db.SaveChanges();


            return(new JsonResult()
            {
            });
        }