public IActionResult UploadSurvey([FromBody] DocumentInputModel model) { if (!ModelState.IsValid) { return(BadRequest()); } return(Ok(_documentAppService.CreateNewDocument(model).Result)); }
public async Task <ResponseViewModel> CreateVendor(VendorCreateInputModel model) { var exist = _userManager.FindByEmailAsync(model.CompanyEmail).Result; if (exist != null) { return(Failed(ResponseMessageViewModel.ACCOUNT_ALREADY_EXITS, ResponseErrorCodeStatus.ACCOUNT_ALREADY_EXIST)); } var user = new AppUser { EntryName = model.CompanyName, UserName = model.CompanyEmail, Email = model.CompanyEmail, PhoneNumber = model.RepresentativePhoneNumber, WebsiteUrl = model.CompanyWebsite, OfficeAddress = model.CompanyAddress, MailingAddress = model.CompanyAddress, RepresentativePhoneNumber = model.RepresentativePhoneNumber, RepresentativeEmail = model.RepresentativeEmail, RepresentativeName = model.RepresentativeName, //DepartmentId = model.DepartmentId }; var result = _userManager.CreateAsync(user, _settings.RawHash).Result; if (!result.Succeeded) { return(Failed(ResponseMessageViewModel.UNABLE_TO_CREATE_VENDOR, ResponseErrorCodeStatus.UNABLE_TO_CREATE_VENDOR)); } var task = await _userManager.AddToRoleAsync(user, Res.VENDOR); if (!task.Succeeded) { return(Failed(ResponseMessageViewModel.UNABLE_ASSIGN_ROLE_TO_VENDOR, ResponseErrorCodeStatus.UNABLE_ASSIGN_ROLE_TO_VENDOR)); } if (!string.IsNullOrEmpty(model.Document)) { await _documentAppService.CreateNewDocument(new DocumentInputModel { Document = model.Document, DocumentType = model.DocumentType, PlotId = 0 }); } return(Ok()); }