public async Task <EntityActionOutcome> CreateEntityAsync(CompanyInputData viewData)
        {
            var newEntity = _factory.Create(viewData);
            var validator = new CompanyDataInputValidator();
            var result    = validator.Validate(viewData);

            if (result.IsValid == false)
            {
                return(EntityActionOutcome.MissingFullEntityData);
            }

            var upsertSuccessful = await _repository.AddAsync(newEntity);

            if (upsertSuccessful == null)
            {
                return(EntityActionOutcome.CreateFailed);
            }

            return(EntityActionOutcome.Success);
        }
Beispiel #2
0
        //[ValidateCompaniesAttribute]
        public async Task <IActionResult> Create([Bind("Id,Unp,Name,Address,DirectorsName,DirectorsPhone")] Companies company)
        {
            await _companies.AddAsync(company);

            return(PartialView("Create", company));
        }