Exemple #1
0
        public static int AddTypeOrganization()
        {
            CreateOrganizationTypeVm model = new CreateOrganizationTypeVm()
            {
                Name = "TOO"
            };

            OrganizationManagementService service = new OrganizationManagementService();

            return(service.AddTypeOrganization(model));
        }
Exemple #2
0
        public static void AddTypeOrganization()
        {
            CreateOrganizationTypeVm model = new CreateOrganizationTypeVm()
            {
                Name = "ИП"
            };

            OrganizationManagementService service = new OrganizationManagementService();

            service.AddTypeOrganization(model);
        }
Exemple #3
0
        //добавление типа организации
        public int AddTypeOrganization(CreateOrganizationTypeVm model)
        {
            var checkType = _aplicationDbContext.OrganizationTypes.FirstOrDefault(p => p.Name == model.Name);

            if (checkType != null)
            {
                throw new Exception("incorrect model!");
            }

            OrganizationType type = new OrganizationType()
            {
                Name = model.Name
            };

            _aplicationDbContext.OrganizationTypes.Add(type);
            _aplicationDbContext.SaveChanges();
            return(type.Id);
        }