Пример #1
0
        public int Save(SaveStudentUser savableObj)
        {
            StudentUserDal currDal = new StudentUserDal()
            {
                Email       = savableObj.Email,
                Id          = savableObj.Id,
                ImageUrl    = savableObj.ImageUrl,
                LastName    = savableObj.LastName,
                Name        = savableObj.Name,
                Password    = savableObj.Password,
                PhoneNumber = savableObj.PhoneNumber
            };

            if (savableObj.Id == default(Guid))
            {
                currDal.Id       = Guid.NewGuid();
                currDal.Password = Globals.GetSHA256(currDal.Id.ToString(), currDal.Password);//shesacvlelia saswrafod
                return(_repository.Insert(currDal));
            }

            currDal.Password = Globals.GetSHA256(currDal.Id.ToString(), currDal.Password);
            _repository.Update(currDal);

            return(0);
        }
Пример #2
0
        public ResponseData <int> SaveStudentUser(SaveStudentUser saveStudentUser)
        {
            ResponseData <int> response = new ResponseData <int>();

            StudentUserFacade facade = new StudentUserFacade();

            try
            {
                response.Data = facade.Save(saveStudentUser);
            }
            catch (Exception ex)
            {
                ExceptionHandlerFactory.Factory.GetResponseExceptionHandler(response).Handle(ex);
            }

            return(response);
        }