Пример #1
0
 public IResult Add(Teacher teacher)
 {
     try
     {
         _ITeacherDal.Add(teacher);
         return(new SuccessResult(message: Contants.Messages.AddMessage));
     }
     catch (Exception ex)
     {
         return(new ErrorResult(message: ex.Message));
     }
 }
Пример #2
0
 public IResult Add(Teacher teacher)
 {
     try
     {
         _teacherDal.Add(teacher);
     }
     catch (Exception)
     {
         return(new Result(false, "Teacher cannot be added"));
     }
     return(new Result(true, "Teacher added"));
 }
        public IResult Add(Teacher teacher)
        {
            //İSTİSNAİ DURUM:Ekleme için gelen data'da HashedPassword'dan salt şifre gelir. Server'da şifrelenir !
            var roomId = new Random().Next(1111111, 9999999);

            teacher.TeacherRoomId = roomId.ToString();
            try
            {
                if (GetByMail(teacher.TeacherMail).Data != null)
                {
                    return(new ErrorResult(Messages.TeacherMailAlreadyTaken));
                }
                teacher.TeacherHashedPassword = new PasswordHasher().HashPassword(teacher.TeacherHashedPassword);
                _teacherDal.Add(teacher);
            }
            catch
            {
                return(new ErrorResult(Messages.TeacherAddingFailed));
            }
            return(new SuccessResult(Messages.TeacherAddedSuccessfully));
        }
Пример #4
0
 public Teacher Add(Teacher entity)
 {
     return(_teacherDal.Add(entity));
 }