Ejemplo n.º 1
0
        public static string CreateOtherBody(OtherBodyModel ngo, string connstring)
        {
            Dictionary <string, object> spParams = new Dictionary <string, object>();

            spParams.Add("@Name", ngo.Name);
            return(DBAccess.ExecuteSQLScalar(connstring, "CALL usp_InsertOtherBody(@Name)", spParams));
        }
Ejemplo n.º 2
0
        public OtherBodyModel Post([FromBody] OtherBodyModel otherbody)
        {
            Response.StatusCode = 201;
            string result = OtherBodyService.CreateOtherBody(otherbody, dbConn);

            otherbody.Id = Convert.ToInt32(result);
            return(otherbody);
        }
Ejemplo n.º 3
0
 public static string UpdateOtherBody(OtherBodyModel ngo, string connstring)
 {
     try
     {
         Dictionary <string, object> spParams = new Dictionary <string, object>();
         spParams.Add("@Id", ngo.Id);
         spParams.Add("@Name", ngo.Name);
         return(DBAccess.ExecuteSQLNonQuery(connstring, "CALL usp_UpdateOtherBody(@Id, @Name)", spParams));
     }
     catch (Exception)
     {
         return("An error occurred");
     }
 }
Ejemplo n.º 4
0
 public string UpdateOtherBody([FromRoute] int id, [FromBody] OtherBodyModel otherbody)
 {
     return(OtherBodyService.UpdateOtherBody(otherbody, dbConn));
 }