public IActionResult AddConference(string co)
        {
            string[]   arr     = co.Split('*');
            string[]   q       = arr[2].Split('-');
            DateTime   date    = new DateTime(int.Parse(q[0]), int.Parse(q[1]), int.Parse(q[2]));
            Conference newConf = new Conference()
            {
                Title       = arr[0],
                Description = arr[1],
                Date        = date,
                ImgPath     = arr[3],
                Likes       = 0,
                Watches     = 0
            };

            conferenceService.Add(newConf);
            var conferences = conferenceService.getAll();
            var result      = conferences
                              .Select(r => new Conference()
            {
                Id          = r.Id,
                Date        = r.Date,
                Description = r.Description,
                ImgPath     = r.ImgPath,
                Likes       = r.Likes,
                Title       = r.Title,
                Watches     = r.Watches
            });

            return(View("Index", result));
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> Add(ConferenceModel conferenceModel)
 {
     if (ModelState.IsValid)
     {
         await ConferenceService.Add(conferenceModel);
     }
     return(RedirectToAction("index"));
 }
        public async Task <IActionResult> Add(ConferenceModel model)
        {
            if (ModelState.IsValid)
            {
                await _conferenceService.Add(model);
            }

            return(RedirectToAction(nameof(Index)));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            await conferenceService.Add(Conference);

            return(RedirectToPage("/Index"));
        }
        public async Task <IActionResult> Add([FromBody] ConferenceModel conference)
        {
            try
            {
                await service.Add(conference);

                return(CreatedAtRoute("GetById", new { id = conference.Id }, conference));
            } catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Ejemplo n.º 6
0
        public ActionResult Create(ConferenceModel REM)
        {
            Conference RE = new Conference
            {
                subject        = REM.subject,
                lieu           = REM.lieu,
                dateConference = REM.dateConference,
                rate           = REM.rate,
                typeConference = REM.typeConference
            };



            resEvSer.Add(RE);
            resEvSer.Commit();
            resEvSer.Dispose();

            RedirectToAction("Index");
            return(View());
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Add([FromBody] ConferenceModel conference)
        {
            var addedConference = await _conferenceService.Add(conference);

            return(CreatedAtRoute("GetById", new { id = addedConference.Id }, addedConference));
        }
 public void Post([FromBody] Conference conference)
 {
     conferenceService.Add(conference);
 }
Ejemplo n.º 9
0
 public ConferenceModel Add([FromBody] ConferenceModel conference)
 {
     return(_conferenceService.Add(conference));
 }
        public IActionResult Add([FromBody] ConferenceDto conference)
        {
            var id = Convert.ToInt32(User.FindFirst(ClaimTypes.NameIdentifier).Value);

            return(Ok(_conferenceService.Add(id, conference)));
        }