Esempio n. 1
0
        public async Task <ActionResult> Edit(Teacher model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var o = th.GetById(model.Id);
                    o.Address = model.Address;

                    o.Lastname     = model.Lastname.ToUpper();
                    o.Firstname    = model.Firstname.ToUpper();
                    o.Gender       = model.Gender;
                    o.Email        = model.Email;
                    o.PhoneNumber  = model.PhoneNumber;
                    o.ModifiedDate = DateTime.UtcNow.Date;
                    o.Salary       = model.Salary;
                    th.Update(o);
                    await th.SaveChangesAsync();

                    return(RedirectToAction("Details", new RouteValueDictionary(
                                                new { controller = "Teacher", action = "Details", Id = o.Id })));
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!th.IfExists(model.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return(View(model));
        }
Esempio n. 2
0
 public bool Update(E_Model.Teacher model)
 {
     return(dal.Update(model));
 }
Esempio n. 3
0
 public bool Update(Teacher entity)
 {
     return(iTeacher.Update(entity));
 }