public async Task <ActionResult> Create(FEP.Intranet.Areas.eEvent.Models.CreateEventSpeakerModel model) { if (model.Attachments.Count() == 0 && model.AttachmentFiles.Count() == 0) { ModelState.AddModelError("Attachments", "Please upload file"); } if (ModelState.IsValid) { var modelapi = new CreateEventSpeakerModel() { //webapi = intranet UserId = model.UserId, UserName = model.UserName, SpeakerType = model.SpeakerType, Experience = model.Experience, SpeakerStatus = model.SpeakerStatus, }; //if (model.ThumbnailFile != null) //{ // var filename = FileMethod.SaveFile(model.ThumbnailFile, Server.MapPath("~/img/EventSpeaker-ProfilePicture")); // modelapi.ThumbnailUrl = filename; //} //attachment if (model.AttachmentFiles.Count() > 0) { var responseFile = await FileMethod.UploadFile(model.AttachmentFiles.ToList(), CurrentUser.UserId); if (responseFile != null) { modelapi.FilesId = responseFile.Select(f => f.Id).ToList(); } } var response = await WepApiMethod.SendApiAsync <int>(HttpVerbs.Post, $"eEvent/EventSpeaker", modelapi); if (response.isSuccess) { await LogActivity(Modules.Event, "Create Event Speaker", model); TempData["SuccessMessage"] = "Event Speaker successfully created"; return(RedirectToAction("List")); } } model.filter_imgs = filter_imgs; return(View(model)); }
public async Task <ActionResult> Create() { var model = new FEP.Intranet.Areas.eEvent.Models.CreateEventSpeakerModel() { SpeakerType = SpeakerType.Internal, SpeakerStatus = SpeakerStatus.Active }; model.UserIds = new SelectList(await GetUsers(), "Id", "Name", 0); model.filter_imgs = filter_imgs; return(View(model)); }