public HttpResponseMessage UpdateFQuestion(FQuestion_Model _obj)
 {
     try
     {
         int id = obj.Save_Update_Delete_FQuestion(_obj);
         if (id > 0)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, id));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.MultipleChoices, "FQuestion already exists"));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
 public HttpResponseMessage DeleteFQuestion(FQuestion_Model _obj)
 {
     try
     {
         int id = obj.Save_Update_Delete_FQuestion(_obj);
         if (id > 0)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, id));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, "FQuestion not found."));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
Exemplo n.º 3
0
        public int Save_Update_Delete_FQuestion(FQuestion_Model _obj)
        {
            int id = 0;

            try
            {
                cmd             = new SqlCommand("Fquestion", cmd.Connection);
                cmd.Connection  = DbConnect.CreateConnection();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@FQuestionId", _obj.FQuestionId);
                cmd.Parameters.AddWithValue("@FQuestion", _obj.FQuestion);
                cmd.Parameters.AddWithValue("@CreatedBy", SessionInfo.UserId);
                cmd.Parameters.AddWithValue("@Action", _obj.Action);
                cmd.Connection.Open();
                id = Convert.ToInt32(cmd.ExecuteScalar());
                cmd.Connection.Close();
                return(id);
            }
            catch (Exception ex)
            {
                return(id);
            }
        }
Exemplo n.º 4
0
 public int Save_Update_Delete_FQuestion(FQuestion_Model _obj)
 {
     return(obj.Save_Update_Delete_FQuestion(_obj));
 }