Esempio n. 1
0
        public async Task <IActionResult> Edit(Int32?id, ProstoBDEditModel model)
        {
            if (id == null)
            {
                return(this.NotFound());
            }

            var prosto = await this._context.Prils
                         .SingleOrDefaultAsync(m => m.Id == id);

            if (prosto == null)
            {
                return(this.NotFound());
            }

            if (this.ModelState.IsValid)
            {
                prosto.Text    = model.Text;
                prosto.Number  = model.Number;
                prosto.Created = DateTime.UtcNow;

                await this._context.SaveChangesAsync();

                return(this.RedirectToAction("Index"));
            }

            return(this.View(model));
        }
Esempio n. 2
0
        // GET: Doctors/Edit/5
        public async Task <IActionResult> Edit(Int32?id)
        {
            if (id == null)
            {
                return(this.NotFound());
            }

            var prosto = await this._context.Prils.SingleOrDefaultAsync(m => m.Id == id);

            if (prosto == null)
            {
                return(this.NotFound());
            }

            var model = new ProstoBDEditModel
            {
                Text    = prosto.Text,
                Number  = prosto.Number,
                Created = prosto.Created
            };

            return(this.View(model));
        }