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)); }
public OtherBodyModel Post([FromBody] OtherBodyModel otherbody) { Response.StatusCode = 201; string result = OtherBodyService.CreateOtherBody(otherbody, dbConn); otherbody.Id = Convert.ToInt32(result); return(otherbody); }
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"); } }
public string UpdateOtherBody([FromRoute] int id, [FromBody] OtherBodyModel otherbody) { return(OtherBodyService.UpdateOtherBody(otherbody, dbConn)); }