Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            SportsType sportsType = db.SportsTypes.Find(id);

            db.SportsTypes.Remove(sportsType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "SportsTypeId,SportType")] SportsType sportsType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sportsType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sportsType));
 }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "SportsTypeId,SportType")] SportsType sportsType)
        {
            if (ModelState.IsValid)
            {
                db.SportsTypes.Add(sportsType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sportsType));
        }
Ejemplo n.º 4
0
        // GET: SportsTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SportsType sportsType = db.SportsTypes.Find(id);

            if (sportsType == null)
            {
                return(HttpNotFound());
            }
            return(View(sportsType));
        }
Ejemplo n.º 5
0
        public async Task <bool> AddBookmark <T>(T item, SportsType sportsType, PageDetailType bookmarkType) where T : ISQLiteStorable, IBookmarkable, new()
        {
            var membershipType = ShinyHost.Resolve <MembershipService>().MemberRoleType;

            if (MembershipAdvantage.TryGetValue(membershipType, out MembershipAdvantage advantage))
            {
                int limitSize = 0;
                switch (bookmarkType)
                {
                case PageDetailType.Match:
                    limitSize = advantage.MatchBookmarkLimit;
                    break;

                case PageDetailType.League:
                    limitSize = advantage.LeagueBookmarkLimit;
                    break;

                case PageDetailType.Team:
                    limitSize = advantage.TeamBookmarkLimit;
                    break;
                }

                int curSavedCnt = (await _sqliteService.SelectAllAsync <T>()).Count;
                if (curSavedCnt < limitSize) // 저장 가능
                {
                    item.Order        = 0;
                    item.StoredTime   = DateTime.UtcNow;
                    item.IsBookmarked = true;

                    var ret = await _sqliteService.InsertOrUpdateAsync <T>(item);

                    Debug.Assert(ret != 0);

                    string message = this.BuildBookmarkMessage(sportsType, bookmarkType);
                    MessagingCenter.Send(this, message, item);

                    UserDialogs.Instance.Toast(LocalizeString.Set_Bookmark);
                }
                else
                {
                    UserDialogs.Instance.Toast(LocalizeString.Bookmark_Inventory_Full);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 6
0
        public async Task <bool> DeleteNotification(int id, SportsType sportsType, NotificationType notificationType)
        {
            var found = await _sqliteService.SelectAsync <NotificationInfo>(
                NotificationInfo.BuildPrimaryKey(id, sportsType, notificationType));

            var ret = await _sqliteService.DeleteAsync <NotificationInfo>(found.PrimaryKey);

            Debug.Assert(ret != 0);

            //NotificationCenter.Current.Cancel(found.Id);

            found.SetIsAlarmed(false);

            string message = this.BuildNotificationMessage(found.SportsType, found.NotificationType);

            MessagingCenter.Send(this, message, found);

            UserDialogs.Instance.Toast(LocalizeString.Cancle_Alarm);
            return(true);
        }
Ejemplo n.º 7
0
        public async Task <bool> RemoveBookmark <T>(T item, SportsType sportsType, PageDetailType bookmarkType, bool showToastMsg = true) where T : ISQLiteStorable, IBookmarkable, new()
        {
            item.Order        = 0;
            item.StoredTime   = DateTime.UtcNow;
            item.IsBookmarked = false;

            var ret = await _sqliteService.DeleteAsync <T>(item.PrimaryKey);

            Debug.Assert(ret != 0);

            string message = this.BuildBookmarkMessage(sportsType, bookmarkType);

            MessagingCenter.Send(this, message, item);

            if (showToastMsg)
            {
                UserDialogs.Instance.Toast(LocalizeString.Delete_Bookmark);
            }

            return(true);
        }
 public static string BuildBookmarkMessage(this IBookmarkService bookmarkService, SportsType sportsType, PageDetailType bookmarkType)
 {
     return($"{sportsType}-{bookmarkType}");
 }
Ejemplo n.º 9
0
 public static string BuildNotificationMessage(this INotificationService bookmarkService, SportsType sportsType, NotificationType notificationType)
 {
     return($"{sportsType}-{notificationType}");
 }
Ejemplo n.º 10
0
        public async Task <List <NotificationInfo> > GetAllNotification(SportsType sportsType, NotificationType notificationType)
        {
            var allitems = await _sqliteService.SelectAllAsync <NotificationInfo>();

            return(allitems.Where(elem => elem.SportsType == sportsType && elem.NotificationType == notificationType).ToList());
        }
Ejemplo n.º 11
0
 public async Task <NotificationInfo> GetNotification(int id, SportsType sportsType, NotificationType notificationType)
 {
     return(await _sqliteService.SelectAsync <NotificationInfo>(
                NotificationInfo.BuildPrimaryKey(id, sportsType, notificationType)));
 }