Esempio n. 1
0
        public async Task <ActionResult> Create([Bind("Id,Firstname,Lastname,Address," +
                                                      "Gender,CreatedDate,Email,PhoneNumber,Salary,HireDate")] Teacher model)
        {
            model.CreatedDate  = DateTime.UtcNow.Date;
            model.ModifiedDate = DateTime.UtcNow.Date;
            if (ModelState.IsValid)
            {
                var o = new Teacher();
                o.Address      = model.Address;
                o.CreatedDate  = model.CreatedDate;
                o.ModifiedDate = model.ModifiedDate;
                o.Lastname     = model.Lastname.ToUpper();
                o.Firstname    = model.Firstname.ToUpper();
                o.Gender       = model.Gender;
                o.Email        = model.Email;
                o.PhoneNumber  = model.PhoneNumber;
                o.HireDate     = model.HireDate;
                o.Salary       = model.Salary;
                th.Add(o);
                await th.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(PartialView(model));
        }
Esempio n. 2
0
        public IActionResult Add(TeacherDto aTeacher)
        {
            Teacher myTeacher = _mapper.Map <Teacher>(aTeacher);

            myTeacher = _repo.Add(myTeacher);
            var myResponse = _mapper.Map <TeacherDto>(myTeacher);

            return(Ok(myResponse));
        }
Esempio n. 3
0
 public bool Add(E_Model.Teacher model)
 {
     return(dal.Add(model));
 }
Esempio n. 4
0
 public bool Add(Teacher entity)
 {
     return(iTeacher.Add(entity));
 }