Esempio n. 1
0
        public async Task <Response <UserVM> > DoLogin(string user, string password, string PlayerId, string PushToken)
        {
            Response <UserVM> response = new Response <UserVM>();

            try
            {
                using (var dc = new RentAppEntities())
                {
                    var queryFilter = dc.spSelUserDoLogin(user, password).ToList();
                    var query       = queryFilter.Where(c => c.StatusUser == true).FirstOrDefault();
                    if (query != null)
                    {
                        var usr = new UserVM();
                        usr.Address      = query.AddressUser;
                        usr.DateCreated  = query.DateCreatedUser;
                        usr.DateModified = query.DateModifiedUser;
                        usr.IconString   = query.IconStringUser;
                        usr.Icon         = query.IconUser;
                        usr.IdAdmin      = query.IdAdmin;
                        usr.IdOwner      = query.IdOwner;
                        usr.Name         = query.NameUser;
                        usr.Password     = query.PasswordUser;
                        usr.Phone        = query.PhoneUser;
                        usr.Status       = query.StatusUser;
                        usr.UserId       = query.UserId;
                        usr.User         = query.UserUser;
                        response.Count   = 1;
                        response.Message = null;
                        response.Result  = usr;
                        await BLNotifications.InsertNotification(usr.UserId, PlayerId, PushToken, 0);
                    }
                    else
                    {
                        response.Count   = 0;
                        response.Message = "No hay datos";
                        response.Result  = null;
                    }
                }
                return(response);
            }
            catch (Exception ex)
            {
                response.Count   = 0;
                response.Message = ex.Message;
                response.Result  = null;
                return(response);
            }
        }
Esempio n. 2
0
        public async Task <Response <OwnerVM> > DoLogin(string user, string password, string PlayerId, string PushToken)
        {
            Response <OwnerVM> response = new Response <OwnerVM>();

            try
            {
                using (var dc = new RentAppEntities())
                {
                    var query = dc.spSelOwnerDoLogin(user, password).Where(c => c.StatusOwner == true).FirstOrDefault();
                    if (query != null)
                    {
                        var o = new OwnerVM();
                        o.Address        = query.AddressOwner;
                        o.DateCreated    = query.DateCreatedOwner;
                        o.DateModified   = query.DateModifiedOwner;
                        o.Icon           = query.IconOwner;
                        o.IconString     = query.IconStringOwner;
                        o.IdAdmin        = query.IdAdmin;
                        o.IdOwner        = query.IdOwner;
                        o.Name           = query.NameOwner;
                        o.Password       = query.PasswordOwner;
                        o.Phone          = query.PhoneOwner;
                        o.Status         = query.StatusOwner;
                        o.User           = query.UserOwner;
                        response.Count   = 1;
                        response.Message = null;
                        response.Result  = o;
                        await BLNotifications.InsertNotification(o.IdOwner, PlayerId, PushToken, 1);
                    }
                    else
                    {
                        response.Count   = 0;
                        response.Message = "No hay datos";
                        response.Result  = null;
                    }
                }
                return(response);
            }
            catch (Exception ex)
            {
                response.Count   = 0;
                response.Message = ex.Message;
                response.Result  = null;
                return(response);
            }
        }
Esempio n. 3
0
        public async Task <Response <AdministratorVM> > DoLogin(string user, string password, string PlayerId, string PushToken)
        {
            Response <AdministratorVM> response = new Response <AdministratorVM>();

            try
            {
                using (var dc = new RentAppEntities())
                {
                    var query = dc.spSelAdministratorDoLogin(user, password).Where(c => c.StatusAdmin == true).FirstOrDefault();
                    if (query != null)
                    {
                        var ad = new AdministratorVM();
                        ad.Address       = query.AdddresAdmin;
                        ad.DateCreated   = query.DateCreatedAdmin;
                        ad.DateModified  = query.DateModifiedAdmin;
                        ad.Icon          = query.IconAdmin;
                        ad.IconString    = query.IconStringAdmin;
                        ad.IdAdmin       = query.IdAdmin;
                        ad.Name          = query.NameAdmin;
                        ad.Password      = query.PasswordAdmin;
                        ad.Phone         = query.PhoneAdmin;
                        ad.Status        = query.StatusAdmin;
                        ad.User          = query.UserAdmin;
                        response.Count   = 1;
                        response.Message = null;
                        response.Result  = ad;
                        await BLNotifications.InsertNotification(ad.IdAdmin, PlayerId, PushToken, 2);
                    }
                    else
                    {
                        response.Count   = 0;
                        response.Message = "No hay datos";
                        response.Result  = null;
                    }
                }
                return(response);
            }
            catch (Exception ex)
            {
                response.Count   = 0;
                response.Message = ex.Message;
                response.Result  = null;
                return(response);
            }
        }