public async Task <IActionResult> AddPlatform(CreatePlatformModel cpm) { if (cpm == null) { return(BadRequest("Platform cannot be null")); } Platform platform = new Platform() { Name = cpm.Name, Url = cpm.Url, Owners = new List <UimvcUser>(), Users = new List <UimvcUser>() }; using (var memoryStream = new MemoryStream()) { await cpm.IconImage.CopyToAsync(memoryStream); platform.IconImage = memoryStream.ToArray(); } using (var memoryStream = new MemoryStream()) { await cpm.CarouselImage.CopyToAsync(memoryStream); platform.CarouselImage = memoryStream.ToArray(); } using (var memoryStream = new MemoryStream()) { await cpm.FrontPageImage.CopyToAsync(memoryStream); platform.FrontPageImage = memoryStream.ToArray(); } var newPlatform = _platformMgr.MakePlatform(platform); return(RedirectToAction("Index", "Platform", new { Id = newPlatform.Id })); }
public async Task <PlatformViewModel> CreatePlatform(CreatePlatformModel request) => await CreateAsync <CreatePlatformModel, PlatformViewModel>(_config.Api.ApiEndpointCreatePlatform, request, nameof(Core.Entities.Platform));