public IHttpActionResult DeleteMapping(int temlateId)
 {
     try
     {
         _mappingManager.DeleteMapping(temlateId.ToString());
         return(Ok());
     }
     catch (WebException exception)
     {
         LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, exception.Message, exception);
         return(BadRequest(exception.Message + " Please check your credentials"));
     }
     catch (Exception exception)
     {
         LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, exception.Message, exception);
         return(BadRequest(exception.Message));
     }
 }
Example #2
0
 public void DeleteMapping(int temlateId)
 {
     try
     {
         _mappingManager.DeleteMapping(temlateId.ToString());
     }
     catch (WebException exception)
     {
         LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, exception.Message, exception);
         throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                                     exception.Message + " Please check your credentials"));
     }
     catch (Exception exception)
     {
         LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, exception.Message, exception);
         throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, exception.Message));
     }
 }
        public ActionResult Delete(string scMappingId)
        {
            try
            {
                MappingManager.DeleteMapping(scMappingId);
                return(new EmptyResult());
            }
            catch (WebException exception)
            {
                Log.Error("GatherContent message: " + exception.Message + exception.StackTrace, exception);
                return(Json(new { status = "error", message = exception.Message + " Please check your credentials" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                Log.Error("GatherContent message: " + e.Message + e.StackTrace, e);

                return(Json(new { status = "error", message = e.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Example #4
0
        public void Delete(string scMappingId)
        {
            object resultObject = null;

            try
            {
                MappingManager.DeleteMapping(scMappingId);
                //return new EmptyResult();
            }
            catch (WebException exception)
            {
                Log.Error("GatherContent message: " + exception.Message + exception.StackTrace, exception);
                resultObject = new { status = "error", message = exception.Message + " Please check your credentials" };
                //return Json(new { status = "error", message = exception.Message + " Please check your credentials" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception e)
            {
                Log.Error("GatherContent message: " + e.Message + e.StackTrace, e);
                resultObject = new { status = "error", message = e.Message };
                //return Json(new { status = "error", message = e.Message }, JsonRequestBehavior.AllowGet);
            }
            finally
            {
                Context.Response.Clear();
                Context.Response.ContentType = "application/json";
                JavaScriptSerializer js = new JavaScriptSerializer();
                if (resultObject != null)
                {
                    Context.Response.Write(js.Serialize(resultObject));
                }
                else
                {
                    Context.Response.Write(String.Empty);
                }
            }
        }