Esempio n. 1
0
        public async Task <IActionResult> OnPostGroupsAsync()
        {
            MemoryStream stream = new MemoryStream();
            await Request.Body.CopyToAsync(stream);

            stream.Position           = 0;
            using StreamReader reader = new StreamReader(stream);
            var requestBody = reader.ReadToEnd();

            if (requestBody.Length > 0)
            {
                var departmentId = Guid.Parse(requestBody);
                IEnumerable <SelectListItem> groupsAsSelectList = await _dropDownService.GetGroups(departmentId);

                return(new JsonResult(groupsAsSelectList));
            }
            return(null);
        }