Ejemplo n.º 1
0
        public JsonNetResult Get(long id)
        {
            try
            {
                var instanceService = new PublicationInstanceService();
                var data            = instanceService.Get(id);

                return(new JsonNetResult()
                {
                    Data = new { success = true, data = data }
                });
            }
            catch (Exception ex)
            {
                return(new JsonNetResult()
                {
                    Data = new { success = false, message = ex.Message }
                });
            }
        }
Ejemplo n.º 2
0
 public JsonResult Update(PublicationInstanceEditDto model)
 {
     try
     {
         var instanceService = new PublicationInstanceService();
         instanceService.Update(model);
         return(Json(new
         {
             success = true,
             message = "Редактирование прошло успешно"
         }));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             success = false,
             message = ex.Message
         }));
     }
 }
Ejemplo n.º 3
0
        public JsonResult Delete(long id)
        {
            try
            {
                var instanceService = new PublicationInstanceService();
                instanceService.Delete(id);

                return(Json(new
                {
                    success = true
                }));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    success = false,
                    message = ex.Message
                }));
            }
        }
Ejemplo n.º 4
0
 public JsonResult Create(PublicationInstanceEditDto model)
 {
     try
     {
         var instanceService = new PublicationInstanceService();
         var newUser         = instanceService.Create(model);
         return(Json(new
         {
             success = true,
             message = "Создание прошло успешно",
             id = newUser.Id
         }));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             success = false,
             message = ex.Message
         }));
     }
 }