Beispiel #1
0
        // GET: eEvent/EventAgenda/Create
        public async Task <ActionResult> Create()
        {
            var model = new FEP.Intranet.Areas.eEvent.Models.CreateEventAgendaModel()
            {
            };

            model.EventIds          = new SelectList(await GetEvent(), "Id", "RefNo");
            model.PersonInchargeIds = new SelectList(await GetUsers(), "Id", "Name");

            return(View(model));
        }
Beispiel #2
0
        public async Task <ActionResult> Create(FEP.Intranet.Areas.eEvent.Models.CreateEventAgendaModel model)
        {
            if (ModelState.IsValid)
            {
                var modelapi = new CreateEventAgendaModel
                {
                    AgendaTitle       = model.AgendaTitle,
                    AgendaDescription = model.AgendaDescription,
                    Time             = model.Time,
                    Tentative        = model.Tentative,
                    EventId          = model.EventId,
                    PersonInChargeId = model.PersonInChargeId
                };

                //attachment
                if (model.AttachmentFiles.Count() > 0)
                {
                    var responseFile = await WepApiMethod.SendApiAsync <List <FileDocument> >($"File?userId={CurrentUser.UserId}", model.AttachmentFiles.ToList());

                    if (responseFile.isSuccess)
                    {
                        modelapi.FilesId = responseFile.Data.Select(f => f.Id).ToList();
                    }
                }

                var response = await WepApiMethod.SendApiAsync <int>(HttpVerbs.Post, $"eEvent/EventAgenda", modelapi);

                if (response.isSuccess)
                {
                    await LogActivity(Modules.Event, "Create Event Agenda", model);

                    TempData["SuccessMessage"] = "Event Agenda successfully created";

                    return(RedirectToAction("List"));
                }
            }

            model.EventIds          = new SelectList(await GetEvent(), "Id", "RefNo");
            model.PersonInchargeIds = new SelectList(await GetUsers(), "Id", "Name");

            return(View(model));
        }