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)); }
public IActionResult Add(TeacherDto aTeacher) { Teacher myTeacher = _mapper.Map <Teacher>(aTeacher); myTeacher = _repo.Add(myTeacher); var myResponse = _mapper.Map <TeacherDto>(myTeacher); return(Ok(myResponse)); }
public bool Add(E_Model.Teacher model) { return(dal.Add(model)); }
public bool Add(Teacher entity) { return(iTeacher.Add(entity)); }