public async Task <bool> InsertOrganizationToCommunity(string CID, OrganizationInsertViewModel organization) { var org = new Organization { OType = organization.OType, CId = organization.CId, Id = Guid.NewGuid().ToString(), Name = organization.Name, Description = organization.Description, StartDate = organization.StartDate, Developers = new List <Developer>(), LogoPath = "" }; var com = await GetCommunity(CID); com.Organizations.Add(org); var result = await _Community.ReplaceOneAsync(x => x.Id == CID, com); return(result.IsAcknowledged); }
public async Task <IActionResult> InsertOrganizationToCommunity([FromRoute] string CID, [FromBody] OrganizationInsertViewModel model) { var result = await _MongocourseService.InsertOrganizationToCommunity(CID, model); if (result) { return(Ok(new { status = 1, Message = "Successfully Inserted" })); } return(BadRequest()); }
public async Task <IActionResult> Insert(OrganizationInsertViewModel model) { TempData.AddResult(await _organizationRepository.AddAsync <OrganizationInsertViewModel>(model)); return(RedirectToAction("Index")); }