Exemplo n.º 1
0
 public IActionResult AddContent(AddContentModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             ContentDetails contentModel = ContentHelper.BindContentDetailsModel(model);
             long           contentId    = iContent.AddContent(contentModel);
             if (contentId > 0)
             {
                 return(Ok(ResponseHelper.Success(MessageConstants.ContentAdded)));
             }
             else if (contentId == ReturnCode.AlreadyExist.GetHashCode())
             {
                 return(Ok(ResponseHelper.Error(MessageConstants.TryDifferentNameShortName)));
             }
             else
             {
                 return(Ok(ResponseHelper.Error(MessageConstants.ContentNotAdded)));
             }
         }
         else
         {
             return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData)));
         }
     }
     catch (Exception ex)
     {
         LogHelper.ExceptionLog(ex.Message + "  :::::  " + ex.StackTrace);
         return(Ok(ResponseHelper.Error(ex.Message)));
     }
 }
Exemplo n.º 2
0
 public IActionResult ContentDetails(ContentDetailModel contentModel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var contentDetailModel = iContent.GetContentDetail(contentModel.shortName);
             if (contentDetailModel != null)
             {
                 AddContentModel addContentModel = ContentHelper.BindContentDetailsModel(contentDetailModel);
                 return(Ok(ResponseHelper.Success(addContentModel)));
             }
             else
             {
                 return(Ok(ResponseHelper.Error(MessageConstants.ContentNotFound)));
             }
         }
         else
         {
             return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData)));
         }
     }
     catch (Exception ex)
     {
         LogHelper.ExceptionLog(ex.Message + "  :::::  " + ex.StackTrace);
         return(Ok(ResponseHelper.Error(ex.Message)));
     }
 }