Ejemplo n.º 1
0
        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"));
            }
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Add(CommunityRequest cData)
        {
            var addEditResponse = await _communityService.Add(cData);

            return(Ok(new AddEditResponse
            {
                Status = addEditResponse.Status,
                Message = addEditResponse.Message,
            }));
        }