예제 #1
0
        public ActionResult Index(UpdateViewModel updateModel)
        {
            {
                if (Membership.GetUser(User.Identity.Name) != null)
                {
                    Update update = new Update();

                    MembershipUser user = Membership.GetUser(User.Identity.Name);
                    Guid guid = (Guid)user.ProviderUserKey;
                    update.UserId = guid;

                    update.Calories = updateModel.Calories;

                    DateTime adjustedTime = DateTime.Now.AddHours(-updateModel.HoursPrior);

                    update.Date = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                    update.Time = DateTime.Parse(adjustedTime.ToString("HH:mm:ss"));

                    if (ModelState.IsValid)
                    {
                        db.Updates.InsertOnSubmit(update);
                        db.SubmitChanges();
                    }
                    return RedirectToAction("Index");
                }
                else
                {
                    return RedirectToRoute("Account", "LogOn");
                }
            }
        }
예제 #2
0
        internal void AddSection(Update update)
        {
            SectionUpdates sectionUpdates = FindSectionUpdates(update.ConfigKey, false);
            sectionUpdates._sections.Add(update.ConfigKey, update);

            // Maintain counts.
            sectionUpdates._cUnretrieved++;
            if (update.Moved) sectionUpdates._cMoved++;
        }
 internal void AddSection(Update update)
 {
     SectionUpdates updates = this.FindSectionUpdates(update.ConfigKey, false);
     updates._sections.Add(update.ConfigKey, update);
     updates._cUnretrieved++;
     if (update.Moved)
     {
         updates._cMoved++;
     }
 }
예제 #4
0
 internal void AddSectionGroup(Update update)
 {
     SectionUpdates sectionUpdates = FindSectionUpdates(update.ConfigKey, true);
     sectionUpdates._sectionGroupUpdate = update;
 }
 internal void AddSectionGroup(Update update)
 {
     this.FindSectionUpdates(update.ConfigKey, true)._sectionGroupUpdate = update;
 }