public async Task <IActionResult> Create(CommunityCreateViewModel model) { try { if (!ModelState.IsValid) { return(View()); } var name = User.Identity.Name; var user = await _userManager.FindByNameAsync(User.Identity.Name); var community = new Community(); community.CreatedAt = DateTime.Now; community.CreatedBy = user.Id; community.Description = model.Description; community.Name = model.Name; _communityService.Add(community); return(RedirectToAction("index")); } catch (Exception ex) { var msg = ex.Message; return(RedirectToAction("index")); } }
public async Task <ActionResult> Add(CommunityRequest cData) { var addEditResponse = await _communityService.Add(cData); return(Ok(new AddEditResponse { Status = addEditResponse.Status, Message = addEditResponse.Message, })); }