Пример #1
0
        private bool CreateUserLicense(UserLicense lic)
        {
            var obj = AutoMapper.Mapper.Map <UserLicense, Core.Model.UserLicense>(lic);

            obj = Work.UserLicenseRepository.Create(obj);
            Work.UserLicenseRepository.Save();
            LicenseLogic licLogic = new LicenseLogic();

            licLogic.UpdateLicenseStatus(obj.LicenseId, true);
            return(obj.Id > 0);
        }
Пример #2
0
        private bool RevokeUserLicense(Core.Model.
                                       UserLicense lic)
        {
            var obj = Work.UserLicenseRepository.GetData(r => r.LicenseId == lic.LicenseId && r.UserId == lic.UserId).FirstOrDefault();

            if (obj == null)
            {
                return(false);
            }
            var obj1 = Work.UserLicenseRepository.Delete(obj);

            Work.UserLicenseRepository.Save();
            LicenseLogic licLogic = new LicenseLogic();

            licLogic.UpdateLicenseStatus(obj1.LicenseId, false);
            return(obj1 != null);
        }