Esempio n. 1
0
        public JsonResult AddBookInterest(int bookId = 0)
        {
            BookInterest model = new BookInterest()
            {
                CustomerId     = ProjectSession.CustomerId,
                BookId         = bookId,
                InterestedDate = DateTime.Now
            };

            int result = this.bookDataBL.Save(model, true, false, 0, "CustomerId", "BookId");

            if (result > 0)
            {
                return(this.Json(new { success = true, status = Infrastructure.SystemEnumList.MessageBoxType.Success.GetDescription(), message = Messages.AddBookInterest, title = Infrastructure.SystemEnumList.Title.Book.GetDescription(), JsonRequestBehavior.DenyGet }));
            }
            else
            {
                return(this.Json(new { success = false, message = Messages.ErrorMessage.SetArguments(General.BookInterest), status = Infrastructure.SystemEnumList.MessageBoxType.Error.GetDescription(), title = Infrastructure.SystemEnumList.Title.Book.GetDescription() }));
            }
        }
Esempio n. 2
0
        public JsonResult RemoveBookInterest(int bookId = 0)
        {
            BookInterest model = new BookInterest()
            {
                CustomerId = ProjectSession.CustomerId,
                BookId     = bookId,
            };

            model = this.bookDataBL.Search(model).FirstOrDefault();
            if (model.ID > 0)
            {
                int result = this.bookDataBL.Delete <BookInterest>(model.ID);
                if (result == 0)
                {
                    return(this.Json(new { success = true, status = Infrastructure.SystemEnumList.MessageBoxType.Success.GetDescription(), message = Messages.RemoveBookInterest, title = Infrastructure.SystemEnumList.Title.Book.GetDescription(), JsonRequestBehavior.DenyGet }));
                }
                else
                {
                    return(this.Json(new { success = false, message = Messages.ErrorMessage.SetArguments(General.BookInterest), status = Infrastructure.SystemEnumList.MessageBoxType.Error.GetDescription(), title = Infrastructure.SystemEnumList.Title.Book.GetDescription() }));
                }
            }

            return(this.Json(new { success = false, message = Messages.ErrorMessage.SetArguments(General.BookInterest), status = Infrastructure.SystemEnumList.MessageBoxType.Error.GetDescription(), title = Infrastructure.SystemEnumList.Title.Book.GetDescription() }));
        }