public async Task <ActionResult <ApiRespnse <SignInApiModel.Response> > > PostAsync(SignInApiModel.Request request)
        {
            var response = new ApiRespnse <SignInApiModel.Response>();

            if (await checkEmail(request.Email))
            {
                return(response);
            }

            var appUser = new Customer()
            {
                Id           = Guid.NewGuid(),
                Email        = request.Email,
                UserName     = request.Email,
                PasswordHash = request.PasswordHash,
                PhoneNumber  = request.PhoneNumber
            };

            var result = await _adminInterface.PostCustomerDetailes(appUser);


            response.Data = new SignInApiModel.Response()
            {
                PhoneNumber    = appUser.PhoneNumber,
                UserName       = appUser.UserName,
                Email          = appUser.Email,
                EmailConfiremd = appUser.EmailConfirmed,
                Id             = appUser.Id.ToString()
            };

            return(Ok(response));
        }
Example #2
0
        public async Task <ActionResult <ApiRespnse <PrintingShopRegisterApiModel.Response> > > PostAsync(PrintingShopRegisterApiModel.Request request)
        {
            var response = new ApiRespnse <PrintingShopRegisterApiModel.Response>();

            if (await checkEmail(request.Email))
            {
                return(response);
            }

            var appUser = new ApplicationUser()
            {
                Id           = Guid.NewGuid().ToString(),
                Email        = request.Email,
                UserName     = request.FullName,
                PasswordHash = request.PasswordHash,
                PhoneNumber  = request.PhoneNumber
            };

            await _printerInterface.PostOwnerDetailes(appUser);


            response.Data = new PrintingShopRegisterApiModel.Response()
            {
                PhoneNumber    = appUser.PhoneNumber,
                FullName       = appUser.UserName,
                Email          = appUser.Email,
                EmailConfiremd = appUser.EmailConfirmed,
                Id             = appUser.Id.ToString()
            };

            return(Ok(response));
        }
Example #3
0
        public ActionResult <ApiRespnse <PrintingShopLoginApiModel.Response> > Post(PrintingShopLoginApiModel.Request request)
        {
            var response = new ApiRespnse <PrintingShopLoginApiModel.Response>();


            ApplicationUser User = new  ApplicationUser();


            User = _printerInterface.FindApplicationUserByEmail(request.Email);


            if (User == null)
            {
                response.Data = new PrintingShopLoginApiModel.Response();
                response.Data.ErrorMessage = " هذا الأيميل غير موجود, هل تريد انشاء حساب جديد ؟";
                return(Ok(response));
            }

            if (User.PasswordHash == request.PasswordHash)
            {
                response.Data                = new PrintingShopLoginApiModel.Response();
                response.Data.Email          = User.Email;
                response.Data.EmailConfiremd = User.EmailConfirmed;
                response.Data.PhoneNumber    = User.PhoneNumber;
                response.Data.Id             = User.Id.ToString();
                response.Data.FullName       = User.UserName;

                response.Data.PrinterId   = User.prentingShopId.ToString();
                response.Data.PrinterName = User.prenterName;
                return(Ok(response));
            }
            else
            {
                response.Data = new PrintingShopLoginApiModel.Response();
                response.Data.ErrorMessage = " رقم سري خاطئ , الرجاء المحاولة مجدداً";
                return(Ok(response));
            }
        }
Example #4
0
        public async Task <ActionResult <ApiRespnse <PrintingShopApiMode.Response> > > PostAsync(PrintingShopApiMode.Request request)
        {
            var response   = new ApiRespnse <PrintingShopApiMode.Response>();
            var NewPrinter = new PrintingShop()
            {
                prentingShopId   = Guid.NewGuid(),
                prenterName      = request.prenterName,
                ownerId          = request.ownerId,
                isCourseMaterial = request.isCourseMaterial,
                isService        = request.isService
            };
            var resulte = await _printingShops.PostPrintingShopDetailes(NewPrinter);

            response.Data = new PrintingShopApiMode.Response()
            {
                prentingShopId   = resulte.prentingShopId.ToString(),
                prenterName      = resulte.prenterName,
                isCourseMaterial = resulte.isCourseMaterial,
                isService        = resulte.isService,
                ownerId          = resulte.ownerId
            };

            return(Ok(response));
        }
        public ActionResult <ApiRespnse <LoginApiModel.Response> > Post(LoginApiModel.Request request)
        {
            var response = new ApiRespnse <LoginApiModel.Response>();


            Customer customer = new Customer();


            customer = _adminInterface.FindCustomerByEmail(request.Email);


            if (customer == null)
            {
                response.Data = new LoginApiModel.Response();
                response.Data.ErrorMessage = " هذا الأيميل غير موجود, هل تريد انشاء حساب جديد ؟";
                return(Ok(response));
            }

            if (customer.PasswordHash == request.PasswordHash)
            {
                response.Data                = new LoginApiModel.Response();
                response.Data.Email          = customer.Email;
                response.Data.EmailConfiremd = customer.EmailConfirmed;
                response.Data.PhoneNumber    = customer.PhoneNumber;
                response.Data.Id             = customer.Id.ToString();
                response.Data.UserName       = customer.UserName;

                return(Ok(response));
            }
            else
            {
                response.Data = new LoginApiModel.Response();
                response.Data.ErrorMessage = " رقم سري خاطئ , الرجاء المحاولة مجدداً";
                return(Ok(response));
            }
        }
        public ActionResult <ApiRespnse <DriverLoginApiModel.Response> > Post(DriverLoginApiModel.Request request)
        {
            var response = new ApiRespnse <DriverLoginApiModel.Response>();


            DeliveryDriver driver = new DeliveryDriver();


            driver = _adminInterface.FindDriverByEmail(request.Email);


            if (driver == null)
            {
                response.Data = new DriverLoginApiModel.Response();
                response.Data.ErrorMessage = " هذا الأيميل غير موجود الرجاء المحاولة مجدداً";
                return(Ok(response));
            }

            if (driver.PasswordHash == request.PasswordHash)
            {
                response.Data             = new DriverLoginApiModel.Response();
                response.Data.Email       = driver.Email;
                response.Data.PhoneNumber = driver.PhoneNumber;
                response.Data.Id          = driver.Id.ToString();
                response.Data.UserName    = driver.UserName;
                response.Data.PrinterId   = driver.IDPrinter.ToString();

                return(Ok(response));
            }
            else
            {
                response.Data = new DriverLoginApiModel.Response();
                response.Data.ErrorMessage = " رقم سري خاطئ , الرجاء المحاولة مجدداً";
                return(Ok(response));
            }
        }