public static int AddTypeOrganization() { CreateOrganizationTypeVm model = new CreateOrganizationTypeVm() { Name = "TOO" }; OrganizationManagementService service = new OrganizationManagementService(); return(service.AddTypeOrganization(model)); }
public static void AddTypeOrganization() { CreateOrganizationTypeVm model = new CreateOrganizationTypeVm() { Name = "ИП" }; OrganizationManagementService service = new OrganizationManagementService(); service.AddTypeOrganization(model); }
//добавление типа организации 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); }