Esempio n. 1
0
        public async Task <IActionResult> Create(CreateCommunityCommand request)
        {
            if (!ModelState.IsValid)
            {
                return(View(request));
            }

            request.User = await userManager.GetUserAsync(HttpContext.User);

            await mediator.Send(request);

            return(RedirectToAction("GetLinks", new { communityName = request.Name }));
        }
        public async Task <IActionResult> AddCommunityPost([FromForm] AddCommunityModel model)
        {
            var community = new CommunityDTO()
            {
                Address   = model.Address,
                EpiCenter = new EpicenterDTO()
                {
                    Latitude = model.Latitude, Longitude = model.Longitude, SRID = 4326, Radius = model.Radius
                },
                InfoUrl    = model.InfoUrl,
                Name       = model.Name,
                PictureUrl = model.PictureUrl
            };
            var command = new CreateCommunityCommand(community);
            var result  = await Mediator.Send(command);

            return(RedirectToAction("ManageCommunity", new { id = result }));
        }