Exemplo n.º 1
0
        public ActionResult Edit(string id, IFormCollection thisForm)
        {
            var libro = db.Titles.Find(id);

            try
            {
                libro.Title    = thisForm["name"];
                libro.Type     = thisForm["type"];
                libro.PubId    = thisForm["pub_id"];
                libro.Price    = decimal.Parse(thisForm["price"]);
                libro.Advance  = decimal.Parse(thisForm["Avance"]);
                libro.Royalty  = int.Parse(thisForm["royal"]);
                libro.YtdSales = int.Parse(thisForm["yearsales"]);
                libro.Notes    = thisForm["notes"];
                libro.Pubdate  = DateTime.Parse(thisForm["pubdate"]);
                db.SaveChanges();
                return(RedirectToAction(nameof(Buscar), new { id = id, va = "__view" }));
            }
            catch (Exception e)
            {
                var model = new BookHelp
                {
                    Model = libro,
                    Pubs  = db.Publishers.ToList(),
                    Types = (from ta in db.Titles
                             select ta.Type).Distinct()
                };
                ViewData["MessageText"] = e.Message;
                return(View(libro));
            }
        }
Exemplo n.º 2
0
        // GET: HomeController1/Create
        public ActionResult Create()
        {
            var model = new BookHelp
            {
                /* Vamos al abc de LINQ . . . */
                Pubs  = db.Publishers.ToList(),
                Types = (from ta in db.Titles
                         select ta.Type).Distinct()
            };

            return(View(model));
        }
Exemplo n.º 3
0
        // GET: LibroController/Edit/5
        public ActionResult Edit(string id)
        {
            var model = new BookHelp
            {
                Model = db.Titles.Where(t => t.TitleId == id).First(),
                Pubs  = db.Publishers.ToList(),
                Types = (from ta in db.Titles
                         select ta.Type).Distinct()
            };

            return(View(model));
        }
Exemplo n.º 4
0
        public void showBookHelpDetail(BookHelp data)
        {
            Glide.With(mContext).Load(Constant.IMG_BASE_URL + data.help.author.avatar)
            //.Placeholder(Resource.Drawable.avatar_default)
            .Transform(new GlideCircleTransform(mContext))
            .Into(headerViewHolder.ivAvatar);

            headerViewHolder.tvNickName.Text     = (data.help.author.nickname);
            headerViewHolder.tvTime.Text         = (FormatUtils.getDescriptionTimeFromDateString(data.help.created));
            headerViewHolder.tvTitle.Text        = (data.help.title);
            headerViewHolder.tvContent.Text      = (data.help.content);
            headerViewHolder.tvCommentCount.Text = (Java.Lang.String.Format(mContext.GetString(Resource.String.comment_comment_count), data.help.commentCount));
        }