public HttpResponseMessage UpdateMsgRequestType(MsgRequestType_Model _obj)
 {
     try
     {
         int id = obj.Save_Update_Delete_MsgRequestType(_obj);
         if (id > 0)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, id));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.MultipleChoices, "Msg Request Type already exists"));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
 public HttpResponseMessage DeleteMsgRequestType(MsgRequestType_Model _obj)
 {
     try
     {
         int id = obj.Save_Update_Delete_MsgRequestType(_obj);
         if (id > 0)
         {
             return(Request.CreateResponse(HttpStatusCode.OK, id));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, "Msg Request Type not found."));
         }
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
     }
 }
        public int Save_Update_Delete_MsgRequestType(MsgRequestType_Model _obj)
        {
            int id = 0;

            try
            {
                cmd             = new SqlCommand("MsgRequestType", cmd.Connection);
                cmd.Connection  = DbConnect.CreateConnection();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@MsgTypeId", _obj.MsgTypeId);
                cmd.Parameters.AddWithValue("@MsgRequestType", _obj.MsgRequestType);
                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_MsgRequestType(MsgRequestType_Model _obj)
 {
     return(obj.Save_Update_Delete_MsgRequestType(_obj));
 }