Пример #1
0
        public ActionResult Create([Bind(Include = "genid,gen_Title")] Genre genre)
        {
            if (ModelState.IsValid)
            {
                db.Genres.Add(genre);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(genre));
        }
Пример #2
0
        private COMPANY CreateCompany(GMEntities context, Company company, int newUserId)
        {
            var gmCompany = new COMPANY
            {
                NAME            = company.Name,
                ADDRESS_LINE_1  = company.AddressLine1,
                ADDRESS_LINE_2  = company.AddressLine2,
                SUBURB          = company.Subarb,
                POST_CODE       = company.PostCode,
                COUNTRY         = company.Country,
                PHONE           = company.Phone,
                ABN             = company.Abn,
                ACCOUNT_NO      = RandomToken.GenerateDigitsOnly(11),
                BSB             = GlobalSettings.Instance.Bsb,
                IS_ACTIVE       = company.IsActive,
                IS_ADMIN        = company.IsAdmin,
                IS_DELETED      = company.IsDeleted,
                CR_BY           = company.CrBy,
                CR_AT           = company.CrAt,
                UP_BY           = company.UpBy,
                UP_AT           = company.UpAt,
                LOGO_PATH       = company.LogoPath,
                AGREEMENT_DATE  = company.AgreementDate,
                AGREEMENT_PATH  = company.AgreementPath,
                EMAIL           = company.Email,
                CONTACT_USER_ID = newUserId,
                GUID            = Guid.NewGuid(),
                ADMIN_FEE       = company.AdminFee
            };

            context.COMPANies.Add(gmCompany);
            context.SaveChanges();
            return(gmCompany);
        }
Пример #3
0
        private USER CreateCompanyUser(GMEntities context, Company company)
        {
            var gmUser = new USER
            {
                FIRST_NAME = company.ContactName,
                EMAIL      = company.Email,
#if DEBUG
                USERNAME = company.Email + "-" + RandomToken.GenerateDigitsOnly(5),
#else
                USERNAME = company.Email,
#endif
                PASSWORD          = RandomToken.GenerateAlphaNumeric(8),
                CR_BY             = company.CrBy,
                CR_AT             = company.CrAt,
                IS_ACTIVE         = true,
                IS_EMAIL_VERIFIED = false,
                GUID  = Guid.NewGuid(),
                TOKEN = RandomToken.GenerateLowerAlphaNumeric(16)
            };

            context.USERs.Add(gmUser);
            context.SaveChanges();
            return(gmUser);
        }