コード例 #1
0
        public ActionResult addEvent(Agenda entidad)
        {
            if (!this.currentUser())
            {
                return(RedirectToAction("Ingresar"));
            }
            AgendaBL objBL = new AgendaBL();

            try
            {
                string absolutePath = HttpContext.Request.Url.Scheme + "://" + HttpContext.Request.Url.Authority + "/" + CONSTANTES.URI_AGENDA;
                objBL.add(entidad, absolutePath);
                createResponseMessage(CONSTANTES.SUCCESS);
                return(RedirectToAction("Agenda"));
            }
            catch
            {
                if (entidad.IdAgenda != 0)
                {
                    createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_UPDATE_MESSAGE);
                }
                else
                {
                    createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_INSERT_MESSAGE);
                }
            }
            TempData["objSent"] = entidad;
            return(RedirectToAction("Evento", new { id = entidad.IdAgenda != 0 ? entidad.IdAgenda.ToString() : "" }));
        }